如何在 Mac 上将 BeautifulSoup4 安装到 python3
How to install BeautifulSoup4 to python3 on Mac
我在 /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?
您应该使用 pip3
可执行文件:
sudo pip3 install beautifulsoup4
如果您没有安装 pip3
:
curl bootstrap.pypa.io/get-pip.py | python3
我在 /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?
您应该使用 pip3
可执行文件:
sudo pip3 install beautifulsoup4
如果您没有安装 pip3
:
curl bootstrap.pypa.io/get-pip.py | python3