简体   繁体   中英

pip install: upgrade a library in /usr without sudo

python-six is installed in /usr and I need to upgrade it, but I don't have root privileges.

I know how to install a library without root privileges:

pip install --install-option="--prefix=$HOME/.local" six

I know how to upgrade a library with root privileges:

pip install --upgrade six

But when I try to upgrade the library as so:

pip install --upgrade --install-option="--prefix=$HOME/.local" six

I get:

Downloading/unpacking six from https://pypi.python.org/packages/source/s/six/six-1.7.3.tar.gz#md5=784c6e5541c3c4952de9c0a966a0a80b
  Running setup.py egg_info for package six

    no previously-included directories found matching 'documentation/_build'
Installing collected packages: six
  Found existing installation: six 1.2.0
    Uninstalling six:
Exception:
OSError: [Errno 13] Permission denied: '/usr/share/pyshared/six-1.2.0.egg-info'

So, how can I upgrade six without sudo?

For this - I would recommend working inside a virtual environment:

http://docs.python-guide.org/en/latest/dev/virtualenvs/

Then you will have total control of your Modules without bugging the SysAdmin for sudo

HTH's Thanks //P

Disclaimer - involves more pip work ;-)

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