pip下载太慢,无法下载。

问题:使用pip安装下载太慢,直接报time out 的错误。

    raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

解决方法:使用清华镜像源。
直接在pip的下载命令后添加

  -i https://pypi.tuna.tsinghua.edu.cn/simple

即可。
例如:
安装pyqt5-tools

   pip install pyqt5-tools -i https://pypi.tuna.tsinghua.edu.cn/simple

安装opencv-python

   pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple

安装torch的时候,显示找不到合适的版本

   pip install torch==1.5.1+cu101 torchvision==0.6.1+cu101  -i https://pypi.tuna.tsinghua.edu.cn/simple
   ERROR: Could not find a version that satisfies the requirement torch==1.5.1+cu101 (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
ERROR: No matching distribution found for torch==1.5.1+cu101

但是执行这条命令后,再从官网下就快得不得了,很迷。

pip install torch==1.5.1+cu101 torchvision==0.6.1+cu101 -f https://download.pytorch.org/whl/torch_stable.html

以上,镜像源真香。

猜你喜欢

转载自blog.csdn.net/AI414010/article/details/107570292