Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Beginner: need to import Beautiful Soup 4 into Python

I learned Python from codecademy and now I'm trying to learn to use it to mine data from a website. I don't have my own Python system set up (only ever used the Codecademy one) and so I need advice on what to download to run my code and how I can import the Beautiful Soup package into it so I can use BS4. I am on a Mac, running OSX 10.9.4. Thanks!

like image 999
Katya Willard Avatar asked Jun 24 '26 12:06

Katya Willard


1 Answers

To install python easy_install on OSX:

curl -O http://python-distribute.org/distribute_setup.py

sudo python distribute_setup.py

sudo rm distribute_setup.py

sudo easy_install pip

After installing the python easy_install package. you can then run:

    easy_install beautifulsoup4

This will allow you to actually include beautifulsoup4 in your python script:

    from bs4 import BeautifulSoup

From there, you will have access to the method BeautifulSoup and I'm assuming you can take it From there. Example:

    soup=BeautifulSoup(urlContent)
like image 101
John Dempsey Avatar answered Jun 26 '26 01:06

John Dempsey