python 规范 -autopep8 安装记录

今天用 pycharm 编写 python 代码时,预备安装 autopep8 做为代码规范。看到的安装指导都是一上来:

pip install autopep8

然后巴拉巴拉的。。。

然鹅我安装,第一步就报错了(你们就没有出错的吗o^O):

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

You are using pip version 10.0.1, however version 19.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

错误原因是超时,建议是升级 pip。

我优先选择升级,执行 python -m pip install --upgrade pip

然鹅。。。无情

ERROR: To modify pip, please run the following command:
c:\users\dell\appdata\local\programs\python\python37\python.exe -m pip install --upgrade pip
You are using pip version 10.0.1, however version 19.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

行行行,都听你的。。。

Downloading https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl (1.4MB)
4% |█▍ | 61kB 2.2kB/s eta 0:10:04Exception:

...

raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
You are using pip version 10.0.1, however version 19.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

哥,你又回来了,还能不能耍了,算了,还是去解决超时的问题吧。。。

能搜索到建议,大抵三种:

  • 1.更换源:在 pip 后面 通过 -i xxx 来指定源,目前不清楚有哪些源,咱要安装的有哪些源也不知道,就先不考虑这个方法吧
  • 2.更改默认设置(嗯,不推荐,我也没试)
  • 3.延长时间:pip --default-time=100 install xx,而我直接设为 1000
100% |████████████████████████████████| 51kB 1.8kB/s

O(∩_∩)O哈哈~

顺便更新一下 pipc:\users\...\python37\python.exe -m pip --default-timeout=1000 install --upgrade pip

不容乐观呀 o^O

36% |███████████▋                    | 512kB 233bytes/s eta 1:04:34  

找个时间,还是改源吧。。。