【发布时间】:2010-10-01 22:10:51
【问题描述】:
我读了这篇文章但没有找到解决方案:http://docs.python.org/install/index.html
【问题讨论】:
-
pip install beautifulsoup4
标签: python macos module installation
我读了这篇文章但没有找到解决方案:http://docs.python.org/install/index.html
【问题讨论】:
标签: python macos module installation
“正常”的方式是:
cd 到结果目录python setup.py install
另一种解决方案是使用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 上通过一个命令即可安装许多不同的第三方包。
【讨论】:
python setup.py install 之前添加sudo 。
【讨论】:
pip install beautifulsoup,没有最后的4,安装一些在导入中找不到的beautifulsoup 包。
Brian 也打败了我,但因为我已经有了成绩单:
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 ...>
【讨论】:
下载包并解压。在终端中,转到包的目录并键入
python setup.py install
【讨论】:
sudo yum remove python-beautifulsoup
或
sudo easy_install -m BeautifulSoup
可以删除旧版本 3
【讨论】:
根据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 文件。 有用。
【讨论】: