【问题标题】:How to install BeautifulSoup4 for Python 2.7 while also having Python 3.4 installed?如何在安装 Python 3.4 的同时为 Python 2.7 安装 BeautifulSoup4?
【发布时间】:2016-06-26 17:52:44
【问题描述】:

我的 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?提前致谢。

【问题讨论】:

    标签: python windows python-2.7 bs4


    【解决方案1】:

    我猜你可以运行 pip2 install bs4 和 pip3 install bs4 在不同的 python 版本上分别安装它们

    【讨论】:

    • 非常感谢您的回答。我从来不知道有命令“pip2”或“pip3”。 :)
    猜你喜欢
    • 1970-01-01
    • 2014-09-13
    • 2016-10-15
    • 1970-01-01
    • 2015-04-05
    • 1970-01-01
    • 2012-06-18
    • 2017-05-09
    • 2015-10-24
    相关资源
    最近更新 更多