权限错误,pip安装

时间:2016-05-31 19:18:41

标签: python permissions pip fedora

我刚开始使用Fedora的新版本,我正在尝试安装pew,以便我可以在一些虚拟python环境中工作。

pip安装正确,至少我是这么认为的。

>>> pip -V
pip 7.1.0 from /usr/lib/python2.7/site-packages (python 2.7)

我知道这个版本有点过时,但至少我有点。现在,当我尝试抓住皮尤时,会发生这种情况。

>>> pip install pew
You are using pip version 7.1.0, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pew
  Using cached pew-0.1.19-py2.py3-none-any.whl
Collecting pythonz-bd>=1.10.2 (from pew)
  Using cached pythonz_bd-1.11.2-py2-none-any.whl
Collecting shutilwhich (from pew)
  Using cached shutilwhich-1.1.0.tar.gz
Requirement already satisfied (use --upgrade to upgrade): setuptools>=17.1 in /usr/lib/python2.7/site-packages (from pew)
Collecting backports.shutil-get-terminal-size (from pew)
  Using cached backports.shutil_get_terminal_size-1.0.0-py2.py3-none-any.whl
Collecting virtualenv-clone>=0.2.5 (from pew)
  Using cached virtualenv-clone-0.2.6.tar.gz
Collecting pathlib (from pew)
  Using cached pathlib-1.0.1.tar.gz
Collecting virtualenv>=1.11 (from pew)
  Using cached virtualenv-15.0.2-py2.py3-none-any.whl
Installing collected packages: pythonz-bd, shutilwhich, backports.shutil-get-terminal-size, virtualenv-clone, pathlib, virtualenv, pew
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 223, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/site-packages/pip/commands/install.py", line 308, in run
    strip_file_prefix=options.strip_file_prefix,
  File "/usr/lib/python2.7/site-packages/pip/req/req_set.py", line 646, in install
    **kwargs
  File "/usr/lib/python2.7/site-packages/pip/req/req_install.py", line 816, in install
    strip_file_prefix=strip_file_prefix
  File "/usr/lib/python2.7/site-packages/pip/req/req_install.py", line 1013, in move_wheel_files
    strip_file_prefix=strip_file_prefix,
  File "/usr/lib/python2.7/site-packages/pip/wheel.py", line 339, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/lib/python2.7/site-packages/pip/wheel.py", line 310, in clobber
    ensure_dir(destdir)
  File "/usr/lib/python2.7/site-packages/pip/utils/__init__.py", line 70, in ensure_dir
    os.makedirs(path)
  File "/usr/lib64/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/lib/python2.7/site-packages/pythonz_bd-1.11.2.dist-info'

对我来说,完全基于“权限被拒绝”位,我应该做这样的事情。

sudo pip install pew

在向我索要密码后,我反复收到此消息。

Collecting pew
  Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', gaierror(-2, 'Name or service not known'))': /simple/pew/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', gaierror(-2, 'Name or service not known'))': /simple/pew/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', gaierror(-2, 'Name or service not known'))': /simple/pew/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', gaierror(-2, 'Name or service not known'))': /simple/pew/

etc...

任何人都可以帮我弄清楚如何在我的新Fedora版本上正确安装pip?

1 个答案:

答案 0 :(得分:0)

忘了我甚至问过这个,但我需要" sudo su"因为我试图将python包安装到需要root的地方。

更永久的解决方法是使用pew来管理我的python环境。在pew环境的上下文中,我将python包安装到不需要root的地方,问题就消失了。