[英]unable to install mysqlclient interface on python3.6
我正在嘗試使用 pip 安裝mysqlclient
pip install mysqlclient
但不斷收到此錯誤
OSError: mysql_config not found
Collecting mysqlclient
Using cached mysqlclient-2.0.3.tar.gz (88 kB)
ERROR: Command errored out with exit status 1:
command: /home/airflow_env/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-dfln7is0/mysqlclient_696dd7cf04d147ed91836f80c68bc64c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-dfln7is0/mysqlclient_696dd7cf04d147ed91836f80c68bc64c/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-l5usa3c5
cwd: /tmp/pip-install-dfln7is0/mysqlclient_696dd7cf04d147ed91836f80c68bc64c/
Complete output (15 lines):
/bin/sh: mysql_config: command not found
/bin/sh: mariadb_config: command not found
/bin/sh: mysql_config: command not found
mysql_config --version
mariadb_config --version
mysql_config --libs
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-dfln7is0/mysqlclient_696dd7cf04d147ed91836f80c68bc64c/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-dfln7is0/mysqlclient_696dd7cf04d147ed91836f80c68bc64c/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-dfln7is0/mysqlclient_696dd7cf04d147ed91836f80c68bc64c/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
我試過了:
pip install --upgrade setuptools
,python-devel
, python3-devel
, mysql-devel
yum install mariadb-devel
給出錯誤Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.excellmedia.net
* extras: centos.excellmedia.net
* updates: centos.excellmedia.net
Resolving Dependencies
--> Running transaction check
---> Package mariadb-devel.x86_64 1:5.5.68-1.el7 will be installed
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.68-1.el7 for package: 1:mariadb-devel-5.5.68-1.el7.x86_64
--> Processing Dependency: openssl-devel(x86-64) for package: 1:mariadb-devel-5.5.68-1.el7.x86_64
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.68-1.el7 will be installed
---> Package openssl-devel.x86_64 1:1.0.2k-21.el7_9 will be installed
--> Processing Dependency: zlib-devel(x86-64) for package: 1:openssl-devel-1.0.2k-21.el7_9.x86_64
--> Processing Dependency: krb5-devel(x86-64) for package: 1:openssl-devel-1.0.2k-21.el7_9.x86_64
--> Running transaction check
---> Package krb5-devel.x86_64 0:1.15.1-50.el7 will be installed
--> Processing Dependency: libkadm5(x86-64) = 1.15.1-50.el7 for package: krb5-devel-1.15.1-50.el7.x86_64
--> Processing Dependency: libverto-devel for package: krb5-devel-1.15.1-50.el7.x86_64
--> Processing Dependency: libselinux-devel for package: krb5-devel-1.15.1-50.el7.x86_64
--> Processing Dependency: libcom_err-devel for package: krb5-devel-1.15.1-50.el7.x86_64
--> Processing Dependency: keyutils-libs-devel for package: krb5-devel-1.15.1-50.el7.x86_64
---> Package zlib-devel.x86_64 0:1.2.7-18.el7 will be installed
--> Running transaction check
---> Package keyutils-libs-devel.x86_64 0:1.5.8-3.el7 will be installed
---> Package libcom_err-devel.x86_64 0:1.42.9-19.el7 will be installed
---> Package libkadm5.x86_64 0:1.15.1-50.el7 will be installed
---> Package libselinux-devel.x86_64 0:2.5-15.el7 will be installed
--> Processing Dependency: libsepol-devel(x86-64) >= 2.5-10 for package: libselinux-devel-2.5-15.el7.x86_64
--> Processing Dependency: pkgconfig(libsepol) for package: libselinux-devel-2.5-15.el7.x86_64
--> Processing Dependency: pkgconfig(libpcre) for package: libselinux-devel-2.5-15.el7.x86_64
---> Package libverto-devel.x86_64 0:0.2.5-4.el7 will be installed
--> Running transaction check
---> Package libsepol-devel.x86_64 0:2.5-10.el7 will be installed
---> Package pcre-devel.x86_64 0:8.32-17.el7 will be installed
Removing mariadb-libs.x86_64 1:5.5.68-1.el7 - u due to obsoletes from installed mysql-community-libs-8.0.22-1.el7.x86_64
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.68-1.el7 will be installed
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.68-1.el7 for package: 1:mariadb-devel-5.5.68-1.el7.x86_64
--> Finished Dependency Resolution
Error: Package: 1:mariadb-devel-5.5.68-1.el7.x86_64 (base)
Requires: mariadb-libs(x86-64) = 1:5.5.68-1.el7
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
我正在使用centos7: CentOS Linux release 7.9.2009 (Core)
我在 centos7 中使用 docker 容器嘗試了這個,沒有遇到任何問題。
正如@Luuk 在評論中所說,您正在嘗試使用 pip 命令而不是 sql 本身安裝到 mysql 的接口。 這就是您收到以下OSError
的原因
>>> OSError: mysql_config not found
首先,您應該按照他們的網頁中的說明安裝 mariadb
$ sudo yum install mariadb-server
然后運行一組命令
$ sudo yum install python3-devel mysql-devel
$ pip install mysqlclient
另請注意,docker 容器中的所有內容都可以正常運行,因為它就像一台單獨的機器。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.