如何纠正pip的路径(python2.7)

如何纠正pip的路径(python2.7),python,python-3.x,python-2.7,pip,ubuntu-16.04,Python,Python 3.x,Python 2.7,Pip,Ubuntu 16.04,我的系统是ubuntu16.04 我有蟒蛇2.7和蟒蛇3.5 在我使用别名python=python3&&unalias python之后 蟒蛇2.7和蟒蛇3.5混合 然后我发现我有两条pip2.7的路径 $ which -a pip /usr/local/bin/pip /home/user/.local/bin/ 然后我删除python pip $sudo apt获取自动删除python pip 并重新安装pip python get-pip.py-prefix=/usr/local/ 当

我的系统是ubuntu16.04 我有蟒蛇2.7和蟒蛇3.5

在我使用别名python=python3&&unalias python之后

蟒蛇2.7和蟒蛇3.5混合

然后我发现我有两条pip2.7的路径

$ which -a pip
/usr/local/bin/pip
/home/user/.local/bin/
然后我删除python pip $sudo apt获取自动删除python pip

并重新安装pip python get-pip.py-prefix=/usr/local/

当我尝试安装软件包时,结果是

$ 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)
我怎样才能解决它?有什么想法吗?非常感谢

/usr/local/lib/python2.7/dist-packages/pip/_-vendor/requests/init.py:83:RequestsDependencyWarning:旧版本的加密[1,2,3]可能会导致速度减慢。 warnings.warnwarning,RequestsDependencyWarning 已满足要求:numpy in/home/user/.local/lib/python2.7/site-packages 1.15.2 当你这样运行sudo时,它的家仍然是你的非根家。因此,它创建的任何目录(如直接缓存)都将归root所有。你只需要:

sudo rm -rf /home/user/.cache/pip/http

删除缓存目录。以非root用户身份再次运行它,您将不会看到错误。

我删除了缓存目录,需要重新安装python包,然后它才能工作。谢谢你的回复
sudo rm -rf /home/user/.cache/pip/http