今天使用mac版本pycharm寫(xiě)Django項(xiàng)目時(shí)疑务,當(dāng)使用pip導(dǎo)入mysqlclient時(shí)出現(xiàn)了如下錯(cuò)誤:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/bin/clang' failed with exit status 1
安裝命令:
pip3 install mysqlclient
莫名奇妙的出現(xiàn)了一大堆錯(cuò)誤眠寿,使用系統(tǒng)的終端試了一下還是如此坯屿,最后通過(guò)查閱在GitHub中找到了答案:
就是添加系統(tǒng)的環(huán)境變量,使用?vi ~/.bash_profile 打開(kāi)環(huán)境變量,然后進(jìn)入插入狀態(tài),將下面兩條語(yǔ)句插入進(jìn)去:
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
然后保存并退出:
最后不要忘記更新一下文件:source ~/.bash_profile? 堂竟,然后再通過(guò) pip3 install mysqlclient安裝就會(huì)成功了
原文鏈接:https://blog.csdn.net/liaoningxinmin/article/details/90410042