pip 安裝mysqlclient 無法安裝
(python36) root@ljpdev:/home/wk-api# pip install mysqlclient
Collecting mysqlclient
Downloading https://mirrors.aliyun.com/pypi/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz (85kB)
100% |████████████████████████████████| 92kB 17.7MB/s
Complete output from command python setup.py egg_info:
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-0_xjz15a/mysqlclient/setup.py", line 16, in <module>
metadata, options = get_config()
File "/tmp/pip-build-0_xjz15a/mysqlclient/setup_posix.py", line 51, in get_config
libs = mysql_config("libs")
File "/tmp/pip-build-0_xjz15a/mysqlclient/setup_posix.py", line 29, in mysql_config
raise EnvironmentError("%s not found" % (_mysql_config_path,))
OSError: mysql_config not found
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-0_xjz15a/mysqlclient/
You are using pip version 9.0.1, however version 19.2.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
安裝下mysql的庫文件
(python36) root@ljpdev:/home/wk-api# apt-get install libmysqlclient-dev python3-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-dev is already the newest version.
The following packages were automatically installed and are no longer required:
libdbi-perl libterm-readkey-perl
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
libmysqlclient18 mysql-common
The following NEW packages will be installed:
libmysqlclient-dev libmysqlclient18 mysql-common
0 upgraded, 3 newly installed, 0 to remove and 75 not upgraded.
Need to get 0 B/1,694 kB of archives.
After this operation, 9,390 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package mysql-common.
(Reading database ... 80571 files and directories currently installed.)
Preparing to unpack .../mysql-common_5.5.62-0+deb8u1_all.deb ...
Unpacking mysql-common (5.5.62-0+deb8u1) ...
Selecting previously unselected package libmysqlclient18:amd64.
Preparing to unpack .../libmysqlclient18_5.5.62-0+deb8u1_amd64.deb ...
Unpacking libmysqlclient18:amd64 (5.5.62-0+deb8u1) ...
Selecting previously unselected package libmysqlclient-dev.
Preparing to unpack .../libmysqlclient-dev_5.5.62-0+deb8u1_amd64.deb ...
Unpacking libmysqlclient-dev (5.5.62-0+deb8u1) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up mysql-common (5.5.62-0+deb8u1) ...
Setting up libmysqlclient18:amd64 (5.5.62-0+deb8u1) ...
Setting up libmysqlclient-dev (5.5.62-0+deb8u1) ...
Processing triggers for libc-bin (2.19-18+deb8u10) ...
再安裝,好使了
(python36) root@ljpdev:/home/wk-api# pip install mysqlclient
Collecting mysqlclient
Downloading https://mirrors.aliyun.com/pypi/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz (85kB)
100% |████████████████████████████████| 92kB 47.8MB/s
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... done
Successfully installed mysqlclient-1.4.2.post1
You are using pip version 9.0.1, however version 19.2.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.