执行命令:
[root@localhost ~]# pip install mysql-connector
报错信息(部分缺省):
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting mysql-connector
......
Could not fetch URL https://pypi.org/simple/mysql-connector/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/mysql-connector/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
Could not find a version that satisfies the requirement mysql-connector (from versions: )
No matching distribution found for mysql-connector
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
报错的原因主要是 pip配置的下载镜像有问题
解决方法:
1.创建~/.pip/pip.conf
[root@localhost ~]# mkdir ~/.pip
[root@localhost ~]# cd ~/.pip
[root@localhost .pip]# vim pip.conf
2.配置pip.conf
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
disable-pip-version-check = true
timeout = 120
[install]
trusted-host=mirrors.aliyun.com
ignore-installed = true
no-dependencies = yes
3.验证
[root@localhost .pip]# pip install mysql-connector
安装成功!!!