[英]how to correct the path of pip (python2.7)
我的系统是ubuntu16.04我有python2.7和python3.5
在我使用alias python=python3
&& unalias python
python2.7和python3.5混合
然后我发现我有两条路径是pip2.7
$ which -a pip
/usr/local/bin/pip
/home/user/.local/bin/
然后我删除python-pip $ sudo apt-get autoremove python-pip
并重新安装pip python get-pip.py --prefix=/usr/local/
$ which -a pip
/usr/local/bin/pip
当我尝试安装软件包时,结果是
$ sudo pip install numpy
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
warnings.warn(warning, RequestsDependencyWarning)
The directory '/home/user/.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.
The directory '/home/user/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: numpy in /home/user/.local/lib/python2.7/site-packages (1.15.2)
我该如何解决? 任何想法? 非常感谢
当您像这样运行sudo
,HOME仍然是您的(非root用户)家。 因此,它创建的任何目录(如直接缓存)都将由root拥有。 您只需要:
sudo rm -rf /home/user/.cache/pip/http
删除缓存目录。 以非超级用户身份再次运行它,您将不会看到错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.