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 包名