python-3.x - pip 安装速度极慢

标签 python-3.x pip ipv6

任何与 pypi 联系的 pip 命令在 Ubuntu 18.04 上运行速度都非常慢。

$ pip install -v pandas                        
Created temporary directory: /tmp/pip-ephem-wheel-cache-hvbcg1k_
Created temporary directory: /tmp/pip-install-7_spppvw
Collecting pandas
  1 location(s) to search for versions of pandas:
  * https://pypi.org/simple/pandas/
  Getting page https://pypi.org/simple/pandas/
  Looking up "https://pypi.org/simple/pandas/" in the cache
  Current age based on date: 324440
  Freshness lifetime from max-age: 600
  Freshness lifetime from request max-age: 600
  Starting new HTTPS connection (1): pypi.org

挂起约 1-2 分钟(至少)。

使用选项 --index-url=http://pypi.python.org/simple/大大加快了速度,但似乎并不理想,因为它跳过了加密。有什么解决方法吗?

最佳答案

此症状可能表示 IPv6 路由或 DNS 问题。任何遇到此问题的人都可以尝试禁用 IPv6 作为解决方法,直到找到根本原因。您可以通过执行以下操作暂时禁用 Ubuntu 上的 IPv6(直到下次重新启动):

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1

关于python-3.x - pip 安装速度极慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50787522/

相关文章:

python - 使用属性装饰器时 Python 中的行为不一致

python - 如何抑制pip升级警告?

c - 如何检测是否支持双栈套接字?

perl - 如何检测系统是否支持ipv6?

sql-server - pyODBC 和 SQL Server 2008 和 Python 3

python-3.x - 在python 3中使用requests.get获取数据之前等待页面加载

python - 在 Python 3(也许是 matplotlib)中绘制革命实体

python - setuptools的 "Programming Language"分类器中版本的目的是什么?

python - 如何在本地文件系统上为 tarball 创建 pip 要求文件?

algorithm - 为 ipv6 实现最长前缀匹配的最佳方法是什么?