简体   繁体   中英

Permission error, pip install

I just started with a new build of fedora, and I am trying to pip install pew, so that I can work on some virtual python environments.

The pip install went correctly, at least I think so.

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

I know the version is a bit outdated, but I have pip at least. Now when I try and grab pew, this happens.

>>> 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'

Seems to me, based solely on the "Permission denied" bit, I should do something like this.

sudo pip install pew

After asking me for a password, I get this message over and over.

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...

Can anyone help me figure out how to pip install correctly on my new fedora build?

Forgot I had even asked this, but I needed to "sudo su" because I was trying to install the python packages to somewhere requiring root.

The more permanent fix was to use pew to manage my python environments. In the context of a pew environment, I installed the python packages to somewhere not requiring root, and the problem went away.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM