centos7安装mysqlclient
程序员文章站
2022-05-29 10:25:52
...
centos7安装mysqlclient
- MySQLdb/_mysql.c:46:20: 致命错误:Python.h:没有那个文件或目录
(venv) [[email protected]-0-10-centos KN]# yum search python3 | grep dev
boost-python36-static.x86_64 : The Python3 Boost C++ static development
python36-cairo-devel.x86_64 : Libraries and headers for python36-cairo
python36-greenlet-devel.x86_64 : C development headers for python36-greenlet
python36-qt5-devel.x86_64 : Development files for python3-qt5
boost-python36-devel.x86_64 : Shared object symbolic links for Boost.Python 3
boost169-mpich-python3-devel.x86_64 : Shared library symbolic links for
boost169-openmpi-python3-devel.x86_64 : Shared library symbolic links for
boost169-python3-devel.x86_64 : Shared object symbolic links for Boost.Python 3
python3-devel.i686 : Libraries and header files needed for Python development
python3-devel.x86_64 : Libraries and header files needed for Python development
python3-idle.i686 : A basic graphical development environment for Python
python3-idle.x86_64 : A basic graphical development environment for Python
python3-pyudev.noarch : A libudev binding
python34-devel.x86_64 : Libraries and header files needed for Python 3
: development
python36-colcon-devtools.noarch : Extension for information about colcon
python36-fido2.noarch : Functionality for FIDO 2.0, including USB device
python36-gobject-devel.x86_64 : Development files for embedding Python 3.6
python36-pillow-devel.x86_64 : Development files for pillow
python36-pycxx-devel.noarch : PyCXX header and source files
python36-sip-devel.x86_64 : Files needed to generate Python bindings for any C++
shiboken-python36-devel.x86_64 : Development files for shiboken
(venv) [[email protected]-0-10-centos KN]# yum install python36-devel
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 python3-devel.x86_64.0.3.6.8-18.el7 将被 安装
--> 正在处理依赖关系 python3-rpm-macros,它被软件包 python3-devel-3.6.8-18.el7.x86_64 需要
--> 正在处理依赖关系 python3-rpm-generators,它被软件包 python3-devel-3.6.8-18.el7.x86_64 需要
--> 正在检查事务
---> 软件包 python3-rpm-generators.noarch.0.6-2.el7 将被 安装
---> 软件包 python3-rpm-macros.noarch.0.3-34.el7 将被 安装
--> 解决依赖关系完成
...
...
...
总计 2.3 MB/s | 244 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : python3-rpm-generators-6-2.el7.noarch 1/3
正在安装 : python3-rpm-macros-3-34.el7.noarch 2/3
正在安装 : python3-devel-3.6.8-18.el7.x86_64 3/3
验证中 : python3-devel-3.6.8-18.el7.x86_64 1/3
验证中 : python3-rpm-macros-3-34.el7.noarch 2/3
验证中 : python3-rpm-generators-6-2.el7.noarch 3/3
已安装:
python3-devel.x86_64 0:3.6.8-18.el7
作为依赖被安装:
python3-rpm-generators.noarch 0:6-2.el7 python3-rpm-macros.noarch 0:3-34.el7
完毕!
(venv) [[email protected]-0-10-centos KN]# pip install mysqlclient
Looking in indexes: http://mirrors.tencentyun.com/pypi/simple
Collecting mysqlclient
Downloading http://mirrors.tencentyun.com/pypi/packages/3c/df/59cd2fa5e48d0804d213bdcb1acb4d08c403b61c7ff7ed4dd4a6a2deb3f7/mysqlclient-2.0.3.tar.gz (88 kB)
|████████████████████████████████| 88 kB 11.8 MB/s
Using legacy 'setup.py install' for mysqlclient, since package 'wheel' is not installed.
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... done
Successfully installed mysqlclient-2.0.3
WARNING: Running pip as root will break packages and permissions. You should install packages reliably by using venv: https://pip.pypa.io/warnings/venv
(venv) [[email protected]-0-10-centos KN]#
- 解决OSError: mysql_config not found问题
yum install mysql-devel gcc gcc-devel python-devel