PIP安装速度极慢速度、PIP

2023-09-03 14:26:41 作者:囿尓、狠緈諨

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

$ 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

windows下python自带的pip安装速度过慢解决方案 最详细

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

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