省流:先尝试关掉代理 若未解决再考虑以下方法 (若关闭代理后下载速度慢 请考虑换源或你自己的网络环境)
在使用如下命令安装pandas时出现错误
pip install pandas
报错:
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/pandas/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/pandas/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/pandas/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/pandas/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/pandas/
ERROR: Could not find a version that satisfies the requirement pandas (from versions: none)
ERROR: No matching distribution found for pandas
尝试使用指定镜像源解决:
pip install pandas -i https://mirrors.tuna.tsinghua.edu.cn/
再次尝试后无果,于是开始查找其他解决方法
使用一行参数实现对加速网址的信任
pip install [包名] -i [加速源网址] --trusted-host [加速源网址]
安装成功:
Looking in indexes: http://pypi.douban.com/simple/
Requirement already satisfied: pandas in d:\anaconda\lib\site-packages (1.4.2)
Requirement already satisfied: numpy>=1.18.5 in d:\anaconda\lib\site-packages (from pandas) (1.21.5)
Requirement already satisfied: python-dateutil>=2.8.1 in d:\anaconda\lib\site-packages (from pandas) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in d:\anaconda\lib\site-packages (from pandas) (2021.3)
Requirement already satisfied: six>=1.5 in d:\anaconda\lib\site-packages (from python-dateutil>=2.8.1->pandas) (1.16.0)
PS C:\Users\ASUS\Desktop\python\pandas> D:\Python\Python39\Scripts\pip.exe install pandas -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
Looking in indexes: http://pypi.douban.com/simple/
Collecting pandas
Downloading http://pypi.doubanio.com/packages/60/53/619c0bcdc45b0a2ac94fc840c67073f8ca3f69344383c7dca0ed20e1ea73/pandas-1.5.1-cp39-cp39-win_amd64.whl (10.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.9/10.9 MB 9.1 MB/s eta 0:00:00
Requirement already satisfied: pytz>=2020.1 in d:\python\python39\lib\site-packages (from pandas) (2022.1)
Requirement already satisfied: python-dateutil>=2.8.1 in d:\python\python39\lib\site-packages (from pandas) (2.8.2)
Collecting numpy>=1.20.3
Downloading http://pypi.doubanio.com/packages/af/74/c02ece94ef88bed0a7f266959fd9bb2c97140345bc792f281b7db390eea9/numpy-1.23.4-cp39-cp39-win_amd64.whl (14.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 14.7/14.7 MB 795.9 kB/s eta 0:00:00
Requirement already satisfied: six>=1.5 in d:\python\python39\lib\site-packages (from python-dateutil>=2.8.1->pandas) (1.16.0)
Installing collected packages: numpy, pandas
Attempting uninstall: numpy
Found existing installation: numpy 1.18.4
Uninstalling numpy-1.18.4:
Successfully uninstalled numpy-1.18.4
Successfully installed numpy-1.23.4 pandas-1.5.1