简体   繁体   中英

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.

However, when I type in the following command I receive a traceback error:

from bs4 import BeautifulSoup

The error tells me that there is no module bs4.

I have also tried: import bs4 from BeautifulSoup import BeautifulSoup import 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)

I successfully used pip in the same exact way to install a module called requests and it was successful.

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. (However, the requests module that I can successfully use is in the same folder as the BeautifulSoup4 module)

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.

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 .

Option 1:

Option 2:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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