BeautifulSoup in Python (with Windows 7)

I wanted to parse some HTML, to better scrape data from the web, so I downloaded BeautifulSoup.

Unzipping was a snap, however I was initially unable to call it from the python shell. As googling this problem proved very frustrating, I figured posting my solution may be valuable to someone.

So …

If the command:

from BeautifulSoup import BeautifulSoup

yields:

Traceback (most recent call last):
File “”, line 1, in
from BeautifulSoup import BeautifulSoup
ImportError: No module named BeautifulSoup

You need to do the following:

1/ go to your BeautifulSoup folder, and run the setup file. This ought to create a file BeautifulSoup.pyc

2/ copy this file, and paste it into the following directory:

python27\Lib\site-packages\

3/ now type:

from BeautifulSoup import BeautifulSoup

into the python shell. If you observe a pause (loading) and then a new line:

>>>

you’re fixed! (I wish I’d found a post like this two hours ago …)

About these ads
This entry was posted in Uncategorized. Bookmark the permalink.

14 Responses to BeautifulSoup in Python (with Windows 7)

  1. orbbyrp says:

    It works!!
    I really appreciate it.

  2. Supita says:

    at least google bring me your post, thanks a lot :)

  3. sar says:

    So I extract the file, run the setup file (double click on setup.py), but I do not see the BeautifulSoup.pyc file created.

  4. resistivecorpse says:

    im having the same issue as the last post, running “python setup.py install” does not generate a beautifupsoup.pyc file

    • Ricardo says:

      I moved to a mac a year or so ago. I will dig out my old HP and have a look. I suggst you install easy install – it works with a bit of fiddling in windows.

  5. ikh says:

    Yeah, same for me. beautifulsoup.pyc file. Just an egg file. And ez_setup doesn’t work, because it doesn’t work for 64-bit machines. I’m starting to think I need to install a virtual machine just for beautiful soup. Not so beautiful.

  6. Ricardo says:

    this post gets lots of hits – it seems that there has been some change (perhaps at the BS end) that make this a little more tricky. I’m going to have a look at this when i get a chance to set up my old HP, but i never seem to find the time (i moved to a Mac, and you should too!).

    Until then, i suggest that you install via one of the package installer helpers. This Stackoverflow post seems to have the right stuff for getting it to work in Windows.

  7. Robt says:

    Wow! I’m genuinely enjoying the style and design of your weblog. Are you using a customized theme or is this readily available to all users? If you do not want to say the name of it out in the public, please contact me. I’d absolutely love to get
    my hands on this template! Kudos.

  8. sdksdkl says:

    SO HELPFUL. THANKS.

  9. Pingback: How can I install the Beautiful Soup module on the window 7? | BlogoSfera

  10. I know this if off topic but I’m looking into starting my own blog and was wondering what all is needed to get set up? I’m assuming having a blog like
    yours would cost a pretty penny? I’m not very internet savvy so I’m not 100% certain.
    Any suggestions or advice would be greatly appreciated.
    Many thanks

  11. George says:

    Thank you

please comment

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