环境:centos7.8 python3.6
更新yum 和 pip
yum update
pip install --upgrade pip
mysql-client 安装报错
ERROR: Package ‘mysql-client’ requires a different Python: 3.6.8 not in ‘>=3.7’
可以换个方法
python36-mysql.x86_64 : An interface to MySQL
这个也可以做到python与MySQL交互
yum install python36-mysql.x86_64
mysqlclient安装报错
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.
原因是缺少依赖环境
yum install mysql-devel gcc gcc-devel python-devel
virtualenvwrapper 安装报错
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
pip install pbr
pip install --no-deps stevedore
pip install virtualenvwrapper
Python3.6 提示 ssl 模块问题
ModuleNotFoundError: No module named ‘_ssl’
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel gcc gcc-c++ openssl-devel
cd python3.6.2/Modules/Setup.dist
大约在209 行 取消注释
SSL=/usr/local/ssl
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
重新编译安装
最后在 python里 import ssl 检查是否有问题