windows环境下执行pip install xxxx老是报错:

Looking in indexes: https://mirrors.aliyun.com/pypi/simple/

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError(0, 'Error'))': /pypi/simple/scrapy/

WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError(0, 'Error'))': /pypi/simple/scrapy/

WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError(0, 'Error'))': /pypi/simple/scrapy/

WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError(0, 'Error'))': /pypi/simple/scrapy/

WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError(0, 'Error'))': /pypi/simple/scrapy/

ERROR: Could not find a version that satisfies the requirement scrapy

ERROR: No matching distribution found for scrapy

Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError(‘Cannot connect to proxy.’, NewConnectionError…

方法一(全局设置)

先执行:

pip config set global.proxy http://mirrors.aliyun.com/pypi/simple/

执行完后出现一个文件,并给出了地址:

C:\Users\Administrator\AppData\Roaming\pip\pip.ini

打开文件,再替换里面的内容:

[global]

index-url = http://mirrors.aliyun.com/pypi/simple/

[install]

trusted-host = mirrors.aliyun.com

方法二(临时)

将【yourpackage 】替换成你需要的依赖

pip install yourpackage -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

建议使用第一种。我就是第一种方式解决的

精彩内容

评论可见,请评论后查看内容,谢谢!!!
 您阅读本篇文章共花了: