Windows+PyCharm+Python3.7+beautifulsoup4安装

当在代码中使用 from bs4 import BeautifulSoup 时,按照提示安装失败。

确认pip版本,19.0.3–>20.2。但是,通过File–>Settings…–>Project Interpreter升级失败,报错

AttributeError: 'NoneType' object has no attribute 'bytes'

在PyCharm的Terminal中,通过 easy_install -U pip 进行升级。

之后安装beautifulsoup4还是报错

ERROR: No matching distribution found for soupsieve>1.2 (from beautifulsoup4)

通过File–>Settings…–>Project Interpreter,安装soupsieve

如果还是失败,File–>Settings…–>Project Interpreter–>±->Manage Repositories,确认Python源是不是https,如果不是的话,改成https,我当前用的 https://pypi.douban.com/simple/

soupsieve安装成功后,再按照正常流程安装beautifulsoup4成功。

你可能感兴趣的:(Python,python,PyCharm,beautifulsoup4,Windows)