Hi
I am trying to run a script that uses beautiful soup, but I get error 'no module named bs4'
First line of code is:
From bs4 import Beautifulsoup
Python version is 2.7.13
OS: raspbian
I installed beautiful with:
Pip install beautifulsoup4
Pip install bs4
Does it make a difference what path I run the above. Have tried in same folder as python and where my script is.
Also tried a few other things I have seen online but nothing seems to work.
Can anybody help or point me in the right direction.
Thanks
- DougieLawson
- Posts: 42313
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
Re: No module named bs4
Why are you using python2, it's a much better idea to use python3 for everything.
To install BS4 use sudo pip install beautifulsoup4; sudo pip3 install beautifulsoup4 to get it for both python versions.
To install BS4 use sudo pip install beautifulsoup4; sudo pip3 install beautifulsoup4 to get it for both python versions.
Languages using left-hand whitespace for syntax are ridiculous
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.
Re: No module named bs4
Thanks for the reply
I have also tried using pip3, and i still got same error. I am using python 2 as it came with raspbian os. Is there and easy way of upgrading this?
Thanks
I have also tried using pip3, and i still got same error. I am using python 2 as it came with raspbian os. Is there and easy way of upgrading this?
Thanks
- DougieLawson
- Posts: 42313
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
Re: No module named bs4
BOTH python2 (aka python) and python3 are installed with Raspbian Stretch.
Run python 3.6 programs with the python3 command.
Run python 3.6 programs with the python3 command.
Languages using left-hand whitespace for syntax are ridiculous
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.
Re: No module named bs4
I think I have installed an older version raspbian. I will try with stretch.
Thanks
Thanks
Re: No module named bs4
Make sure you install modules globally using 'sudo pip' or 'sudo pip3'.
In general you should not use 'sudo' to start your scripts.
In general you should not use 'sudo' to start your scripts.