简体   繁体   English

即使我已经使用pip Linux Mint Sarah成功安装了BeautifulSoup4,它也无法正常工作

[英]BeautifulSoup4 is not working even though I have successfully installed it using pip Linux Mint Sarah

I am a brand new linux user using linux mint sarah and I just installed python 3.5 as well as BeautifulSoup to do some web scraping. 我是一个使用linux mint sarah的全新Linux用户,我刚刚安装了python 3.5以及BeautifulSoup来进行一些网络抓取。

However, when I type in the following command I receive a traceback error: 但是,当我键入以下命令时,我收到回溯错误:

from bs4 import BeautifulSoup 从bs4导入BeautifulSoup

The error tells me that there is no module bs4. 该错误告诉我没有模块bs4。

I have also tried: import bs4 from BeautifulSoup import BeautifulSoup import beautifulsoup 我也尝试过:从BeautifulSoup导入bs4导入BeautifulSoup导入beautifulsoup

This is weird because if I go into terminal and give the command pip list, it shows me a list of all my programs and it states that I have beautifulsoup4 (4.5.1) 这很奇怪,因为如果我进入终端并给出命令点列表,它会向我显示所有程序的列表,并指出我有beautifulsoup4(4.5.1)

I successfully used pip in the same exact way to install a module called requests and it was successful. 我以相同的方式成功地使用了pip来安装名为请求的模块,并且成功。

One thing that I think may be getting in the way is that Linux mint comes with python 2.7 installed and my modules are going into a 2.7 folder which seems odd. 我认为可能会遇到的一件事是,Linux mint附带安装了python 2.7,而我的模块进入了2.7文件夹,这似乎很奇怪。 (However, the requests module that I can successfully use is in the same folder as the BeautifulSoup4 module) (但是,我可以成功使用的请求模块与BeautifulSoup4模块在同一文件夹中)

I must admit I have not tried easy_install because it gives me some error about the directory not existing when I try to install BeautifulSoup4 that way. 我必须承认我没有尝试过easy_install,因为当我尝试以这种方式安装BeautifulSoup4时,它给我关于目录不存在的错误。

I'm muddying the waters too much so I will leave it at that. 我把水弄得太多了,所以我就不用管它了。 Hopefully, somebody can help me figure out whats going on so that people who have this problem in the future can benefit. 希望有人可以帮助我弄清楚发生了什么事,以便将来有此问题的人都能从中受益。

Thanks! 谢谢!

You need to install BeautifulSoup4 for Python 3.5 . 您需要为Python 3.5安装BeautifulSoup4

Option 1: 选项1:

Option 2: 选项2:

暂无
暂无

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

相关问题 我尝试在 mac os 终端中运行我的 python 程序,但在我成功安装 Beautifulsoup4 后不断收到以下反馈 - I tried running my python program in a mac os terminal but keep getting the feedback below after I have successfully installed Beautifulsoup4 pip无法正常运行,即使已正确安装 - pip is not working , even though it is properly installed ModuleNotFoundError 即使我已经用 pip 安装了它 - ModuleNotFoundError even though I already installed it with pip 无法导入 selenium,即使我在 vscode 中安装了 python 和 pip - not able to import selenium, even though I have python and pip installed in vscode pip 安装 pandas 不工作,即使我似乎有 pip - pip install pandas not working even though it seems I have got pip 为什么'pip'需要“setuptools> = 0.8”,即使我安装了2.1? - Why does 'pip' require “setuptools >= 0.8” even though I have 2.1 installed? Python 抛出 ModuleNotFoundError 即使我使用 pip install 安装了本地 package - Python throws ModuleNotFoundError even though I installed a local package using pip install PyCharm 没有名为“nltk”的模块,即使我使用 pip3 安装了它? - PyCharm No module named 'nltk' even though I've installed it using pip3? Pip 即使我下载了 python 也显示未安装? - Pip showing up an not installed even though I downloaded python? 即使安装了pip,也找不到pip [3]命令 - pip[3] command not found even though pip is installed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM