1. 程式人生 > >ubuntu16.04下更新pip

ubuntu16.04下更新pip

使用pip install –upgrade pip 總是報錯。。。。
Uninstalling pip-7.1.0:
Exception:
Traceback (most recent call last):
File “/usr/lib/python3.5/shutil.py”, line 538, in move
os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: ‘/usr/local/lib/python3.5/dist-packages/pip-7.1.0-py3.5.egg’ -> ‘/tmp/pip-whm8ys6u-uninstall/usr/local/lib/python3.5/dist-packages/pip-7.1.0-py3.5.egg’

嘗試用如下命令進行更新pip成功解決了以上的問題
sudo python -m pip install –upgrade pip
The directory ‘/home/wang/.cache/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
You are using pip version 7.1.0, however version 9.0.1 is available.
You should consider upgrading via the ‘pip install –upgrade pip’ command.
The directory ‘/home/wang/.cache/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
Collecting pip
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 127kB/s
Installing collected packages: pip
Found existing installation: pip 7.1.0
Uninstalling pip-7.1.0:
Successfully uninstalled pip-7.1.0
Successfully installed pip-9.0.1