在新的电脑上配置Python环境,pip安装第三方库时遇到了一些问题,记录一下。

pip install scrapy

报错: 

WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) 
after connection broken by 'ProtocolError('Connection aborted.', 
ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None)

查找了一下资料,说是网络的问题,切换到其他的镜像来加速。

pip install 包名 -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

还是报错:

ERROR: Could not find a version that satisfies the requirement scrapy (from versions: none)
ERROR: No matching distribution found for scrapy

trust文件改成这个就可以了:

pip install pandas --proxy=http://你的代理域名:端口 --trusted-host pypi.org --trusted-host files.pythonhosted.org

还有一种方法是直接在pycharm里安装第三方库,成功了。

file-->settings-->Project:xxxx--->Project Interpreter--> 右边有个加号 + 添加你要的第三方库

 

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐