问题
I wanted to write a program to scrape a website from python. Since there is no built-in possibility to do so, I decided to give the BeautifulSoup module a try.
Unfortunately I encountered some problems using pip and ez_install, since I use Windows 7 64 bit and Python 3.3.
Is there a way to get the BeautifulSoup module on my Python 3.3 installation with Windows 7 64x without ez_install or easy_install, since I have too much trouble with this, or is there an alternative module which can be easily installed?
回答1:
You just need to add to download it and add it to your python search path directly. (Which is in sys.path, if you need to check it.)
From the documentation: Beautiful Soup is licensed under the MIT license, so you can also download the tarball, drop the bs4/ directory into almost any Python application (or into your library path) and start using it immediately. (If you want to do this under Python 3, you will need to manually convert the code using 2to3.)
回答2:
Just download here and then add the BeautifulSoup.py (uncompress the download tarball file use uncompress soft such as 7z)
to your python sys.path use sys.path.append("/path/to/BeautifulSoup.py")
, of cource you can just put it under your current src dir as a normal python module or put it in the pathon's sys path.
BTW the tarball install(or build) way is:
cd BeautifulSoup
python setup.py install(or build)
if you are using python3, you can dowload the bs4(look at the commetn under this answer)
, just let the bs4
(in the tarball source dir) under your python's sys path and then
from bs4 import BeautifulSoup
good luck~
回答3:
I haven't tried it, but check out pip to install python packages. It's supposed to be better.
Why use pip over easy_install
I have personally used BeautifulSoup and like it. I have heard pyquery is good too with a jquery like interface.
来源:https://stackoverflow.com/questions/18701464/beautifulsoup-installation-or-alternative-without-easy-install