H-Jack

As long as the heart unwilling, there is no time to give up.

Python安装三方库包出现timeout的解决方法

参考了几种网上的办法,下述办法最便捷且亲测有效。

1.新建一个.py文件

新建pippeizhi.py

import os
 
ini="""[global]
index-url = https://pypi.doubanio.com/simple/
[install]
trusted-host=pypi.doubanio.com
"""
pippath=os.environ["USERPROFILE"]+"\\pip\\"
 
if not os.path.exists(pippath):
    os.mkdir(pippath)
 
with open(pippath+"pip.ini","w+") as f:
    f.write(ini)
print('OK')

这里用了 douban 的源。

2.cmd运行python 文件路径 pippeizhi.py

3.cmd中输入pip install ***就可以安装自己想要的库。

 

代码出处:https://blog.csdn.net/qq_36659201/article/details/81534280

博主:从嘉嘉

posted @ 2019-12-03 21:23  H-Jack  阅读(944)  评论(0编辑  收藏  举报