BeautifulSoup is not defined

5,833 views
Skip to first unread message

gecon

unread,
Oct 19, 2014, 3:57:45 PM10/19/14
to beauti...@googlegroups.com
I think I have sussessfully installed pip
then installed lxml using  pip install lxml
then installed requests using pip install requests

I have also dowloaded beautifulsoup4-4.3.2 and extracted it
I have successfully ran python setup.py install
done pip install beautifulsoup4

I have added C:\Python\Scripts in the Environment variables

However when I write from bs4 import beautifulsoup4/BeautifulSoup, I get syntax error

It says that from is not recognized as an internal or external command

also when I do

soup = BeautifulSoup(r.content), it says that name BeautifulSoup is not defined 

Guys please help me out with this

thanks

Asad Dhamani

unread,
Oct 28, 2014, 6:47:55 PM10/28/14
to beauti...@googlegroups.com
What you have to do is "from bs4 import BeautifulSoup", but if I understand what you said correctly, you actually did "from bs4 import beautifulsoup4/BeautifulSoup", which is incorrect. 
Also, after installing pip, doing just "pip install beautifulsoup4" should work, as pip will also install any dependencies. 
I do not have Windows, but did you try running this command directly at a command prompt? That wouldn't work, you have to create a .py file. 

Steven Kuipers

unread,
Jul 8, 2015, 10:28:16 AM7/8/15
to beauti...@googlegroups.com
Thanks for this -> "from bs4 import BeautifulSoup"!
It was driving me crazy that I couldn't find BeautifulSoup after installing it with pip.



Op dinsdag 28 oktober 2014 23:47:55 UTC+1 schreef Asad Dhamani:
Reply all
Reply to author
Forward
0 new messages