如何在Mac上安装Beautiful Soup模块?

时间:2009-01-16 22:26:46

标签: python macos module installation

我在没有找到解决方案的情况下阅读此内容:http://docs.python.org/install/index.html

6 个答案:

答案 0 :(得分:76)

“正常”的方式是:

另一种解决方案是使用easy_install。转到http://peak.telecommunity.com/DevCenter/EasyInstall),使用该页面上的说明安装软件包,然后在终端窗口中键入:

easy_install BeautifulSoup4
# for older v3:
# easy_install BeautifulSoup

easy_install将负责下载,解包,构建和安装软件包。使用easy_install的好处是它知道如何搜索许多不同的Python包,因为它查询PyPI注册表。因此,一旦您的计算机上有easy_install,就可以通过shell上的一个命令安装许多不同的第三方软件包。

答案 1 :(得分:25)

我认为目前正确的方法是pip和Pramod评论一样

pip install beautifulsoup4

由于Python的最后更改,请参阅讨论here。 过去并非如此。

答案 2 :(得分:14)

布莱恩也打败了我,但因为我已经有了成绩单:

easy_install

aaron@ares ~$ sudo easy_install BeautifulSoup
Searching for BeautifulSoup
Best match: BeautifulSoup 3.0.7a
Processing BeautifulSoup-3.0.7a-py2.5.egg
BeautifulSoup 3.0.7a is already the active version in easy-install.pth

Using /Library/Python/2.5/site-packages/BeautifulSoup-3.0.7a-py2.5.egg
Processing dependencies for BeautifulSoup
Finished processing dependencies for BeautifulSoup

..或正常无聊的方式:

aaron@ares ~/Downloads$ curl http://www.crummy.com/software/BeautifulSoup/download/BeautifulSoup.tar.gz > bs.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 71460  100 71460    0     0  84034      0 --:--:-- --:--:-- --:--:--  111k

aaron@ares ~/Downloads$ tar -xzvf bs.tar.gz 
BeautifulSoup-3.1.0.1/
BeautifulSoup-3.1.0.1/BeautifulSoup.py
BeautifulSoup-3.1.0.1/BeautifulSoup.py.3.diff
BeautifulSoup-3.1.0.1/BeautifulSoupTests.py
BeautifulSoup-3.1.0.1/BeautifulSoupTests.py.3.diff
BeautifulSoup-3.1.0.1/CHANGELOG
BeautifulSoup-3.1.0.1/README
BeautifulSoup-3.1.0.1/setup.py
BeautifulSoup-3.1.0.1/testall.sh
BeautifulSoup-3.1.0.1/to3.sh
BeautifulSoup-3.1.0.1/PKG-INFO
BeautifulSoup-3.1.0.1/BeautifulSoup.pyc
BeautifulSoup-3.1.0.1/BeautifulSoupTests.pyc

aaron@ares ~/Downloads$ cd BeautifulSoup-3.1.0.1/

aaron@ares ~/Downloads/BeautifulSoup-3.1.0.1$ sudo python setup.py install
running install
<... snip ...>

答案 3 :(得分:4)

下载包并打开包装。在终端中,转到包的目录并键入

python setup.py install

答案 4 :(得分:-1)

sudo yum remove python-beautifulsoup

OR

sudo easy_install -m BeautifulSoup

可以删除旧版本3

答案 5 :(得分:-1)

根据http://for-ref-only.blogspot.de/2012/08/installing-beautifulsoup-for-python-3.html的建议,我使用Windows命令提示符:

C:\Python\Scripts\easy_install c:\Python\BeautifulSoup\beautifulsoup4-4.3.1

其中BeautifulSoup \ beautifulsoup4-4.3.1是下载并解压缩的beautifulsoup4-4.3.1.tar文件。 有用。

相关问题