如何在安装 Python 3.4 的同时为 Python 2.7 安装 BeautifulSoup4?

How to install BeautifulSoup4 for Python 2.7 while also having Python 3.4 installed?

我的 Windows 8.1 系统上安装了 Python 2.7.11 和 Python 3.4.1。我用 pip 安装了 BeautifulSoup4 到 运行 代码(不是我的)。但是,pip 自动将 bs4 安装到 Python 3.4.1。 (我检查过它安装在 C://Python34/lib/site-packages/bs4

我已经使用命令提示符,将目录更改为 C:\Python27(其中安装了 Python 2.7),然后从该目录 pip install bs4,但没有用.我已经从 Python 3.4 复制了 bs4 文件夹,但它也没有用。它只给出了另一个导入错误:没有名为 html.entities.

的模块

如何在 Python 2.7 上安装 bs4?提前致谢。

我想你可以 运行 pip2 install bs4pip3 install bs4 将它们分别安装在不同的 python 版本上