在Fedora 19上安装beautifulsoup4

时间:2013-09-26 12:38:29

标签: python python-2.7 beautifulsoup fedora

我正在尝试使用此命令在Fedora 19上安装名为beautifulsoup4的python模块:

pip install beautifulsoup4

但终端给我一个错误:

Downloading/unpacking beautifulsoup4
  Running setup.py egg_info for package beautifulsoup4

Installing collected packages: beautifulsoup4
  Running setup.py install for beautifulsoup4
    error: could not create '/usr/lib/python2.7/site-packages/bs4': Permission denied
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-misha/beautifulsoup4/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-kevEjw-record/install-record.txt --single-version-externally-managed:
    running install

running build

running build_py

running install_lib

creating /usr/lib/python2.7/site-packages/bs4

error: could not create '/usr/lib/python2.7/site-packages/bs4': Permission denied

----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-misha/beautifulsoup4/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-kevEjw-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build-misha/beautifulsoup4
Storing complete log in /home/misha/.pip/pip.log

我该如何解决?

感谢。

2 个答案:

答案 0 :(得分:4)

您无权安装该库。如果你进入sudoers,你应该输入:

sudo pip install beautifulsoup4

如果您无权安装任何内容,则可以使用[virtualenv][1]创建工作环境并安装所需的所有内容。

答案 1 :(得分:0)

sudo dnf安装python-beautifulsoup4