DjangoBlog
DjangoBlog copied to clipboard
Ubuntu 18.04 无法安装myslqclient,有遇到的吗?
使用sudo apt-get install libmysqlclient-dev 等很多方法都不成功
centos下,yum -y install mysql-devel gcc gcc-devel python-devel,其他版本可自行查找
ubuntu 18.04按照查找的解决方案一直无法解决! @coder-fly
具体的异常能贴出来吗,刚才我在一个新的ubuntu18.04容器中安装mysqlclient成功,
首先执行,apt-get install libmysqlclient-dev python3.6-dev,可以解决mysql_config异常,
此时安装会出现
/usr/bin/ld: cannot find -lcrypto /usr/bin/ld: cannot find -lcrypto collect2: error: ld returned 1 exit status error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
需要进入到 /usr/lib/x86_64-linux-gnu
cp libssl.so.1.1 libssl.so cp libcrypto.so.1.1 libcrypto.so
@w5dy
@w5dy 具体异常贴出来吧,你这样大家没办法帮你。
@liangliangyy @coder-fly 错误有点多 build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o -lmysqlclient -lpthread -lz -lm -lrt -latomic -lssl -lcrypto -ldl -o build/lib.linux-x86_64-3.6/MySQLdb/_mysql.cpython-36m-x86_64-linux-gnu.so /usr/bin/ld: cannot find -lssl /usr/bin/ld: cannot find -lcrypto collect2: error: ld returned 1 exit status error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
按照我上面的步骤就可以解决
@coder-fly 谢谢;按照/usr/lib/x86_64-linux-gnu cp libssl.so.1.1 libssl.so cp libcrypto.so.1.1 libcrypto.so 这个步骤成功了
我使用了下面的指令后再安装mysqlclient成功: sudo apt install libssl-dev
@liangliangyy 为啥要用mysqlclient来的,超级难安装,感觉99%的人会死在这个依赖安装上!!!我真的搞了好多天才弄成功的,有点难。有没有其他方法
sudo apt-get install python-dev default-libmysqlclient-dev
之后在pip就可以了
@ttphoon2010 因为django当时升级2.2的时候,不支持PyMySQL,请参考 https://github.com/PyMySQL/PyMySQL/issues/790
还是装不上,烦。。。。 Note, selecting 'python-dev-is-python2' instead of 'python-dev'
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
ERROR: Failed building wheel for mysqlclient
本菜鸟也死在mysql
docker 部署起不来放弃了自己写c++的算了
https://stackoverflow.com/questions/76585758/mysqlclient-cannot-install-via-pip-cannot-find-pkg-config-name-in-ubuntu
这个mysqlclient是真的难用,3.9.6不兼容这个,死活安装不了,其他版本的mysqlclient又会有其他错误
安装mysql-client前,要确保已经安装mysql。否则会出现mysql-client安装时报错pkg-config找不到。。。,并且mysql版本需要8.0,不然项目无法运行。