如何在Mac上将BeautifulSoup4安装到python3

时间:2016-02-21 04:13:58

标签: python-2.7 python-3.x beautifulsoup bs4

我在/ usr / bin / python中有原始的Python 2.7.5,我通过在/ usr / local / bin / python3下载Python 3.5.1软件包安装了Python3,然后按如下方式安装了BeautifulSoup4:

sudo easy_install BeautifulSoup4
Searching for BeautifulSoup4
Best match: beautifulsoup4 4.4.1
Processing beautifulsoup4-4.4.1-py2.7.egg
beautifulsoup4 4.4.1 is already the active version in easy-install.pth

Using /Library/Python/2.7/site-packages/beautifulsoup4-4.4.1-py2.7.egg
Processing dependencies for BeautifulSoup4
Finished processing dependencies for BeautifulSoup4

这样我就无法在python3中使用bs4,如何在python3上安装bs4?

1 个答案:

答案 0 :(得分:5)

您应该使用pip3可执行文件:

sudo pip3 install beautifulsoup4

如果您没有安装pip3

curl bootstrap.pypa.io/get-pip.py | python3