解决Python使用pip安装库文件出现“Error:Cannot unpack file…”的情况
1、安装库文件:
以安装beautifulsoup4为例,在命令行中直接输入命令:pip install beautifulsoup4,如果下载速度很慢,或者下载失败,建议使用国内源下载。
国内源下载:pip install 包名-i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
详细可参考:Python之安装扩展库与模块导入
2、如果出现:“Error:Cannot unpack file”的情况,以Beautiful Soup为例,如下图所示:
解决方法:
使用命令:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn 包名