我无法在 python 上导入漂亮的汤

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18121715/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 09:57:06  来源:igfitidea点击:

I cannot import beautiful soup on python

pythonbeautifulsouppython-import

提问by Kyungho Park

I installed Beautiful Soup library, and it seems to be well set up as there is the bs4folder in C:\Python33\Lib\site-packages.

我安装了美丽的汤库,它似乎很好地建立,因为是bs4在文件夹中C:\Python33\Lib\site-packages

(I changed the name into bs4before installation, and it went the same after install)

(我bs4安装前改了名字,安装后还是一样)

But when I type in from bs4 import beautifulsoupin the code, it says there is no such library.

但是当我输入from bs4 import beautifulsoup代码时,它说没有这样的库。

And I don't see any beautifulsoup.pyor something. Isn't there supposed to be one?

我什么也没看到beautifulsoup.py。不是应该有吗?

I'm really confused. Anyone help please?

我真的很困惑。请问有人帮忙吗?

回答by shshank

The module names are case sensitive.

模块名称区分大小写。

Try

尝试

from bs4 import BeautifulSoup

回答by Waajid Aslam

Make sure you give 'B' and 'S' as capital while typing 'BeautifulSoup'

确保在输入“BeautifulSoup”时将“B”和“S”作为大写

回答by Ahmed I. Elsayed

If you have a file in the same directory called bs4.py, This is the problem, don't name your files as package names, and btw package names are case-sensitive.

如果您在同一目录中有一个名为 的文件bs4.py,这就是问题所在,不要将您的文件命名为包名,顺便说一下,包名是区分大小写的。