python安装mysql数据库提示Could not install packages due to an OSError:HTTPSConnectionPool

问题

  • 一、问题描述
  • 二、解决方法

一、问题描述

python连接数据库,需要导入mysql.connector包,但通过pip命令安装:pip install mysql-connector-python 时,报如下错误:

ERROR: Could not install packages due to an OSError:
HTTPSConnectionPool(host=‘files.pythonhosted.org’, port=443): Max
retries exceeded with url:
/packages/09/49/9f70542e711802788cd46c315ba7b69be09140e628048707e43506f7c858/mysql_connector_python-8.0.27-1commercial-py2.py3-none-any.whl
(Caused by
ConnectTimeoutError( object at 0x045C5930>, ‘Connection to files.pythonhosted.org timed
out. (connect timeout=15)’))

如图所示:
python安装mysql数据库提示Could not install packages due to an OSError:HTTPSConnectionPool_第1张图片

二、解决方法

问题原因是由于权限问题,在pip install 后加个user便可解决,亲测有效

pip install --user mysql-connector-python

如图所示:
python安装mysql数据库提示Could not install packages due to an OSError:HTTPSConnectionPool_第2张图片

你可能感兴趣的:(问题分析记录,python,mysql,数据库)