无法安装Beautifulsoup(“bs4不存在”)

时间:2013-07-12 15:34:05

标签: python beautifulsoup

我很难在Windows上安装BeautifulSoup。到目前为止,我有:

  1. 将BeautifulSoup下载到“我的下载”。

  2. 在下载文件夹中解压缩/解压缩。

  3. 在命令提示符下,我运行了:

    C:<path to python33> "C:path to beautiful soup\setup.py" install
    
  4. 该过程生成了消息:

    running install
    running build
    running build_py
    **error: package directory 'bs4' does not exist.**
    

    然而,在上面引号中的BeautifulSoup路径中,确实存在文件夹bs4。我错过了什么?

5 个答案:

答案 0 :(得分:10)

您需要位于包含setup.py的目录中才能运行它。确保您的工作目录正确无误。

答案 1 :(得分:7)

我有类似的问题。在我的情况下,我能够让pip工作,但首先我必须找到正确的名称:

错误:pip install bs4

失败

错误:pip install beautifulsoup

失败

右:pip install beautifulsoup4

已成功安装beautifulsoup4

答案 2 :(得分:2)

在尝试使用this tutorial将我的wordpress博客导出到jekyll时遇到了同样的问题。

我的第一步是成功安装pip&amp;接下来尝试用它安装BeautifulSoup:

pip install bs4 # failed
pip install BeautifulSoup # that was succes

但是......第二行安装BeatifulSoup3,而不是最近的版本4 ......

所以我已经卸载了bs3:

pip uninstall BeautifoulSoup # with success 

this site&amp;中删除了最近的bs4。在command / mingw中手动安装:

cd %bs4-download-dir%
python setup.py install

现在一切正常:)

答案 3 :(得分:2)

对于没有pip和easy_install的全新安装:

您的路径 (按路径更改)

  1. 你的python路径:c:\ Python27 \ python.exe
  2. 你的美丽路径:c:\ BeautifulSoup
  3. 清洁安装的说明:

    1. cd c:\ BeautifulSoup

    2. “c:\ Python27 \ python.exe”setup.py install

    3. 玩得开心,分享!

      “任何傻瓜都可以知道。关键是要理解。“

答案 4 :(得分:1)

确保用于运行“python”“\ beautifulsoup4-4.3.1 \ setup.py”安装的批处理文件与“\ beautifulsoup4-4.3.1 \ setup.py”位于同一目录中