ubuntu 18.04 pip3 install mysqlclient

不知道是阿里云的问题还是ubuntu本身的问题,今天安装mysqlclient提示:

/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

网上搜了一下没有发现类似的错误信息,于是转换思路直接搜索: /usr/bin/ld: cannot find -lssl 在这篇文章看到了解决方案:

https://blog.51cto.com/eminzhang/1285705

按照错误信息,直接尝试安装libssl:

apt install libssl-dev

Reading package lists… Done
Building dependency tree
Reading state information… Done
Suggested packages:
libssl-doc
The following NEW packages will be installed:
libssl-dev
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
Need to get 1,566 kB of archives.
After this operation, 7,846 kB of additional disk space will be used.
Get:1 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/main amd64 libssl-dev amd64 1.1.1-1ubuntu2.1~18.04.5 [1,566 kB]
Fetched 1,566 kB in 0s (30.7 MB/s)
Selecting previously unselected package libssl-dev:amd64.
(Reading database … 113385 files and directories currently installed.)
Preparing to unpack …/libssl-dev_1.1.1-1ubuntu2.1~18.04.5_amd64.deb …
Unpacking libssl-dev:amd64 (1.1.1-1ubuntu2.1~18.04.5) …
Setting up libssl-dev:amd64 (1.1.1-1ubuntu2.1~18.04.5) …

安装成功后,如果继续尝试安装libcrypto-dev,就会直接报错了,因为没有这个库:

Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package libcrypto-dev

虽然报错,但是此时重新安装mysqlclient就成功了:

root@iZbp14eg6x181fumvost8tZ:/var/www/html# pip install mysqlclient
Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/
Collecting mysqlclient
Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/d0/97/7326248ac8d5049968bf4ec708a5d3d4806e412a42e74160d7f266a3e03a/mysqlclient-1.4.6.tar.gz (85kB)
100% |████████████████████████████████| 92kB 36.2MB/s
Building wheels for collected packages: mysqlclient
Running setup.py bdist_wheel for mysqlclient … done
Stored in directory: /root/.cache/pip/wheels/76/e8/97/ee5bddf8f9ef442b375f511cd0507060b8498c02f5086168f2
Successfully built mysqlclient
Installing collected packages: mysqlclient
Successfully installed mysqlclient-1.4.6

☆版权☆

* 网站名称:obaby@mars
* 网址:https://oba.by/
* 个性:https://oba.by/
* 本文标题: 《ubuntu 18.04 pip3 install mysqlclient》
* 本文链接:https://oba.by/2020/01/6746
* 短链接:https://oba.by/?p=6746
* 转载文章请标明文章来源,原文标题以及原文链接。请遵从 《署名-非商业性使用-相同方式共享 2.5 中国大陆 (CC BY-NC-SA 2.5 CN) 》许可协议。


You may also like

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注