2016-05-31 167 views
1

我刚刚开始使用新版本的fedora,并且正在尝试pip install pew,以便我可以在一些虚拟python环境中工作。权限错误,pip安装

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' 

对我来说,仅仅基于“Permission denied”位,我应该这样做。

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吗?

+0

我似乎通过更改为根“sudo su - ”然后点安装pew来解决这个问题,但我不会回答,直到我找出为什么以及如何工作。 – Zack

+0

我试图安装在Ubuntu上,它的工作原理。看来你正面临着网络问题。请检查您的网络(使用ping命令)和您的代理(如果有的话) – Vivek

+0

不直接相关,而是使用sudo pip,尝试设置virtualenv并在其中安装库(可能使用requirements.txt)。它将是便携式的。 – SuperSaiyan

回答

0

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

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