Python Forum
I have BeautifulSoup instaled - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html)
+--- Thread: I have BeautifulSoup instaled (/thread-756.html)

Pages: 1 2 3 4


I have BeautifulSoup instaled - Blue Dog - Nov-03-2016

when I try to run a piece of script with this in it      ( from bs4 import BeautifulSoup) Sad

I get this error:      ImportError: No module named bs4 Huh
I have it installed see:

c:\Python2.7>pip install beautifulsoup4
Requirement already satisfied (use --upgrade to upgrade): beautifulsoup4 in c:\p
ython3.5\lib\site-packages

Why can't I make this work. It will not run in 2.7 or 3.5?
Thank you
P.S. I have made My first email scraper, all my own code. Thank you all for your help.


RE: I have BeautifulSoup instaled - metulburr - Nov-03-2016

try
pip install bs4


RE: I have BeautifulSoup instaled - Blue Dog - Nov-03-2016

Thank you
but I try that does not work:

c:\Python3.5>pip install bs4
Requirement already satisfied (use --upgrade to upgrade): bs4 in c:\python3.5\li
b\site-packages
Requirement already satisfied (use --upgrade to upgrade): beautifulsoup4 in c:\p
ython3.5\lib\site-packages (from bs4)

c:\Python3.5>


RE: I have BeautifulSoup instaled - metulburr - Nov-03-2016

try pip install bs4 --upgrade


RE: I have BeautifulSoup instaled - Blue Dog - Nov-03-2016

I did that too:

c:\Python3.5> pip install bs4 --upgrade
Requirement already up-to-date: bs4 in c:\python3.5\lib\site-packages
Requirement already up-to-date: beautifulsoup4 in c:\python3.5\lib\site-packages
(from bs4)


RE: I have BeautifulSoup instaled - snippsat - Nov-03-2016

If you want to install in to Python2.7,navigate to Scripts folder(pip is placed here).
Output:
C:\Python27\Scripts>pip install beautifulsoup4
Then it use pip for Python2.7 and install to 2.7


Quote:Requirement already up-to-date: bs4 in c:\python3.5\lib\site-packages
Then it should work in Python 3.5?
Test it's 3.5 for you.
C:\>python
Python 3.4.2 (v3.4.2:ab2c023a9432, Oct  6 2014, 22:15:05) [MSC v.1600 32 bit (Intel)] on win32
>>> from bs4 import BeautifulSoup
>>> soup = BeautifulSoup('<p>Hello</p>', 'html.parser')
>>> soup.find('p').text
'Hello'



RE: I have BeautifulSoup instaled - Blue Dog - Nov-03-2016

Will you tell what I just did, it worked.
How did that scrip make it work? Smile


RE: I have BeautifulSoup instaled - Larz60+ - Nov-03-2016

pip is designed to run for one version of python only.

What happened is that when you run pip without a qualifier (path),
it will use the system default python which is set up as an environment variable, or is in your path.

When you switch to the scripts directory, you have the local copy of pip that is tied to the
version of python containing that (scripts) directory, so it will install for that version


RE: I have BeautifulSoup instaled - snippsat - Nov-03-2016

(Nov-03-2016, 04:02 PM)Blue Dog Wrote: How did that scrip make it work?
Maybe you had wrong import before.
You can look at tutorials i have here.


RE: I have BeautifulSoup instaled - Blue Dog - Nov-03-2016

I need to install bs4 in python 2.7.
where do I get the 2.7 file at?