Ubuntu解决pip超时问题

今天在pip install -r requirements.txt 遇到超时问题
如下:

ERROR: Exception:
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ckq/anaconda3/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 186, in _main
    status = self.run(options, args)
    raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

一开始不断尝试反复操作,发现一直不行

将pip修改成国内源!!

mkdir .pip
cd .pip
sudo gedit pip.conf

赋值一下内容

[global]
timeout = 6000
index-url = https://pypi.doubanio.com/simple/
[install]
use-mirrors = true
mirrors = https://pypi.doubanio.com/simple/

结果马上就下载完成!!!!

使用pip安装其他包在这里插入代码片

安装包
sudo pip install 包名 
#更新包
sudo pip install -U 包名
#删除包
sudo pip uninstall 包名
#显示已安装的包和版本信息
pip list

参考

参考

Windows可以参考这个

你可能感兴趣的:(Ubuntu安装软件及问题)