Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu 18.04 无法安装myslqclient,有遇到的吗? #335

Open
w5dy opened this issue Nov 20, 2019 · 17 comments
Open

Ubuntu 18.04 无法安装myslqclient,有遇到的吗? #335

w5dy opened this issue Nov 20, 2019 · 17 comments

Comments

@w5dy
Copy link

w5dy commented Nov 20, 2019

使用sudo apt-get install libmysqlclient-dev 等很多方法都不成功

@coder-fly
Copy link

centos下,yum -y install mysql-devel gcc gcc-devel python-devel,其他版本可自行查找

@w5dy w5dy changed the title 无法安装myslqclient,有遇到的吗? Ubuntu 18.04 无法安装myslqclient,有遇到的吗? Nov 20, 2019
@w5dy
Copy link
Author

w5dy commented Nov 20, 2019

ubuntu 18.04按照查找的解决方案一直无法解决! @coder-fly

@coder-fly
Copy link

coder-fly commented Nov 20, 2019

具体的异常能贴出来吗,刚才我在一个新的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

@liangliangyy
Copy link
Owner

@w5dy 具体异常贴出来吧,你这样大家没办法帮你。

@w5dy
Copy link
Author

w5dy commented Nov 20, 2019

@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
Copy link

按照我上面的步骤就可以解决

@w5dy
Copy link
Author

w5dy commented Nov 20, 2019

@coder-fly 谢谢;按照/usr/lib/x86_64-linux-gnu
cp libssl.so.1.1 libssl.so cp libcrypto.so.1.1 libcrypto.so
这个步骤成功了

@Wyler-Yue
Copy link

我使用了下面的指令后再安装mysqlclient成功:
sudo apt install libssl-dev

@ttphoon2010
Copy link

@liangliangyy 为啥要用mysqlclient来的,超级难安装,感觉99%的人会死在这个依赖安装上!!!我真的搞了好多天才弄成功的,有点难。有没有其他方法

@ResistanceTo
Copy link

sudo apt-get install python-dev default-libmysqlclient-dev
之后在pip就可以了

@liangliangyy
Copy link
Owner

@ttphoon2010 因为django当时升级2.2的时候,不支持PyMySQL,请参考 PyMySQL/PyMySQL#790

@winner106
Copy link

还是装不上,烦。。。。
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

@xjqx2z
Copy link

xjqx2z commented Oct 23, 2023

本菜鸟也死在mysql

@marklove5102
Copy link

docker 部署起不来放弃了自己写c++的算了

@mylc2010
Copy link

这个mysqlclient是真的难用,3.9.6不兼容这个,死活安装不了,其他版本的mysqlclient又会有其他错误

@imangoa
Copy link

imangoa commented Mar 28, 2024

安装mysql-client前,要确保已经安装mysql。否则会出现mysql-client安装时报错pkg-config找不到。。。,并且mysql版本需要8.0,不然项目无法运行。
KkzUN9Z3mt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests