【Python】ModuleNotFoundError: No module named ‘bs4‘;ERROR: Could not find a version that satisfies th

程序运行报错: 

D:\PyCharm_Project\venv\Scripts\python.exe D:/PyCharm_Project/Scrap.py
Traceback (most recent call last):
  File "D:/PyCharm_Project/Scrap.py", line 2, in
    from bs4 import BeautifulSoup
ModuleNotFoundError: No module named 'bs4'

ERROR: Could not find a version that satisfies the requirement bs4 ERROR: No matching distribution found for bs4 

ERROR: Could not find a version that satisfies the requirement BeautifulSoup4 ERROR: No matching distribution found for BeautifulSoup4

首先安装beautifulsoup4,直接在电脑cmd中安装:区分python版本,当前是python3.0

pip3 install beautifulsoup4

【Python】ModuleNotFoundError: No module named ‘bs4‘;ERROR: Could not find a version that satisfies th_第1张图片

 可能遇到的问题,网络代理的问题,把代理关掉,正常网络下载;

【Python】ModuleNotFoundError: No module named ‘bs4‘;ERROR: Could not find a version that satisfies th_第2张图片

 在PyCharm中执行程序,还是报错提示“ModuleNotFoundError: No module named 'bs4'”,需要手动添加;

找到D:\Program Files (x86)\python3.9.4\Lib\site-packages\bs4;

在PyCharm中打开Setting:

【Python】ModuleNotFoundError: No module named ‘bs4‘;ERROR: Could not find a version that satisfies th_第3张图片

 【Python】ModuleNotFoundError: No module named ‘bs4‘;ERROR: Could not find a version that satisfies th_第4张图片

【Python】ModuleNotFoundError: No module named ‘bs4‘;ERROR: Could not find a version that satisfies th_第5张图片

 至此bs4安装完成。

 参考资料:

python - ImportError: No Module Named bs4 (BeautifulSoup) - Stack Overflowhttps://stackoverflow.com/questions/11783875/importerror-no-module-named-bs4-beautifulsouppip - ERROR: Could not find a version that satisfies the requirement virualenv (from versions: none) during the installation of beautifulsoup - Stack Overflowhttps://stackoverflow.com/questions/58993826/error-could-not-find-a-version-that-satisfies-the-requirement-virualenv-from-v

常见插件安装

pip install bs4 Code Examplepip install beautifulsoup4https://www.codegrepper.com/code-examples/shell/pip+install+bs4 

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