由于环境错误,pip install pandas 失败

Jac*_*ckU 8 python pip pandas

我正在尝试安装熊猫,但出现此错误:

Collecting pandas

Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/26/fc/d0509d445d2724fbc5f9c9a6fc9ce7da794873469739b6c94afc166ac2a2/pandas-0.23.4-cp37-cp37m-win32.whl 
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/26/fc/d0509d445d2724fbc5f9c9a6fc9ce7da794873469739b6c94afc166ac2a2/pandas-0.23.4-cp37-cp37m-win32.whl 
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/26/fc/d0509d445d2724fbc5f9c9a6fc9ce7da794873469739b6c94afc166ac2a2/pandas-0.23.4-cp37-cp37m-win32.whl 
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/26/fc/d0509d445d2724fbc5f9c9a6fc9ce7da794873469739b6c94afc166ac2a2/pandas-0.23.4-cp37-cp37m-win32.whl 
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/26/fc/d0509d445d2724fbc5f9c9a6fc9ce7da794873469739b6c94afc166ac2a2/pandas-0.23.4-cp37-cp37m-win32.whl 
Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/26/fc/d0509d445d2724fbc5f9c9a6fc9ce7da794873469739b6c94afc166ac2a2/pandas-0.23.4-cp37-cp37m-win32.whl (Caused by ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)"))
Run Code Online (Sandbox Code Playgroud)

我以管理员身份在命令提示符下运行,我正在输入pip install pandas. 我有 pip 版本 18.1。我还尝试在 Windows PowerShell 的 Python 脚本目录中运行它。

我以前从未遇到过安装软件包的问题。

错误是由什么引起的,我该如何解决?

EcS*_*ync 11

看起来您正在尝试在有防火墙的公司网络上安装,您可以连接到另一个 WiFi 或热点并再次尝试下载吗?


Luk*_*icz 6

您与服务器的连接似乎很慢。尝试增加超时:

sudo pip install --default-timeout=120 pandas
Run Code Online (Sandbox Code Playgroud)

或者,您可以使用:

export PIP_DEFAULT_TIMEOUT=120
Run Code Online (Sandbox Code Playgroud)

这是 pip 在决定连接超时之前将等待的时间(以秒为单位)(现在在您的情况下为 15 秒 - “读取超时 = 15”)