安装第三方包有多种方法,有时候也会失败,可以尝试更换方法。
首先先贴一下安装源:
https://pypi.tuna.tsinghua.edu.cn/simple
https://mirrors.aliyun.com/pypi/simple/
https://pypi.mirrors.ustc.edu.cn/simple/
http://pypi.hustunique.com/
http://pypi.sdutlinux.org/
https://pypi.douban.com/simple/
1、Pycharm安装
2、命令行安装
pip install pakage_name -i https://pypi.tuna.tsinghua.edu.cn/simple
3、手动安装
可先上软件源找到对应的tar.gz类型压缩包,下载下来后解压,复制到 \venv\Lib\site-packages,命令行进入改包的文件夹,可以看到有一个setup.py,执行命令
python setup.py install
也可以在以下网站下载对应的whl类型,下载下来后解压,复制到 \venv\Lib\site-packages,命令行进入改包的文件夹,可以看到有一个setup.py,执行命令
pip install pakage_name
https://www.lfd.uci.edu/~gohlke/pythonlibs/
1、pip install xx 时 出错
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to p
roxy.', timeout('_ssl.c:1106: The handshake operation timed out'))': /simple/sqlparse/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to p
roxy.', timeout('_ssl.c:1106: The handshake operation timed out'))': /simple/sqlparse/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to p
roxy.', timeout('_ssl.c:1106: The handshake operation timed out'))': /simple/sqlparse/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to p
roxy.', timeout('_ssl.c:1106: The handshake operation timed out'))': /simple/sqlparse/
解决方法 一:
pip install package_name -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
解决方法二:
解决方法三:
C:\Users\xxx\AppData\Roaming下,找到pip文件夹,如果没有的话就创建一个,再在pip文件夹下创建文件pip.ini,添加一下内容
[global]
timeout = 6000
index-url = http://pypi.douban.com/simple
trusted-host = pypi.douban.com