简体   繁体   English

通过 pip 安装包工作正常但仍然导入错误

[英]Installing package via pip works fine but still import error

I am using this python version我正在使用这个 python 版本

 Python 3.7.0

And this pip version还有这个 pip 版本

 pip 18.0

And then I install the bs4 package然后我安装 bs4 包

pip install beautifulsoup4
pip install bs4

This all works (without errors) but now when I run a python script with:这一切都有效(没有错误)但是现在当我运行 python 脚本时:

from bs4 import BeautifulSoup

I get the following error:我收到以下错误:

ModuleNotFoundError: No module named 'bs4'

Any thoughts on what goes wrong here?关于这里出了什么问题的任何想法?

I am assuming you are trying to install BeautifulSoup4.我假设您正在尝试安装 BeautifulSoup4。 If so, try:如果是这样,请尝试:

pip install beautifulsoup4

and then you will be able to import bs4 using:然后您将能够使用以下方法导入 bs4:

import bs4

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM