2016-09-30 208 views
0

Pip已在我的机器上运行多年,但最近我无法启动它。为了解决这个问题,我跑:PIP已安装,但未找到命令

$ sudo python get-pip.py 
The directory '/Users/tomeldridge/Library/Caches/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 '/Users/tomeldridge/Library/Caches/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. 
Collecting pip 
    Downloading pip-8.1.2-py2.py3-none-any.whl (1.2MB) 
    100% |████████████████████████████████| 1.2MB 759kB/s 
Collecting wheel 
    Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB) 
    100% |████████████████████████████████| 71kB 4.3MB/s 
Installing collected packages: pip, wheel 
    Found existing installation: pip 7.1.2 
    Uninstalling pip-7.1.2: 
     Successfully uninstalled pip-7.1.2 
Successfully installed pip-8.1.2 wheel-0.29.0 

但是PIP仍然不能正常工作:

$ pip --version 
-bash: pip: command not found 

我想我可能会导致出现此问题与$PATH搞乱。

当我运行`须藤的bash -c '回声$ PATH' 我得到:

/usr/sbin:/usr/bin:/sbin:/bin:usr/local/bin 

这是正确的吗?

+1

'pip'(和大多数库)通常安装在用户范围内。也许你登录了另一个用户帐户? – lucasnadalutti

+0

这个命令怎么样:“python -m pip --version”? – guilhermecgs

+0

你可以检查'/ usr/local/opt'中是否有可执行文件** pip **吗? – JHolub

回答

2

您的问题是在您的路径usr/local/bin,它必须是/usr/local/bin

这应该做到这一点。

你应该可以在文件~/.bash_profile中改变它。