Install Beautiful Soup on Mac

This is my (very) first blog post! I am a soon-to-be Ph.D. student in the department of political science at UC San Diego. And I plan to blog about political science, text as data, and China frequently in the future.

This blog post is a quick guide to the people who want to use Beautiful Soup, an awesome Python library, for their scraping projects. In the context of text analysis, Beautiful Soup saves a lot of time when you parse files such as HTML documents.

Here’s how you install Beautiful Soup on your Mac —

0. Use Python 2.7 (instead of 3)

1. Install Beautiful Soup

1.1 Download “beautifulsoup4-4.4.1.tar.gz” from here

1.2 Type Terminal in Spotlight to open Terminal

1.2.1 In Terminal, change working directory, for example, I type

$ cd /Users/Shane/Desktop/beautifulsoup4-4.4.1

1.2.2 In Terminal, type python setup.py install

1.3 Launch Python and type

from bs4 import BeautifulSoup

Advertisements

One thought on “Install Beautiful Soup on Mac

  1. Pingback: Text Processing in Python (1) | Shane Xinyang Xuan

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s