2016-09-30 557 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中改變它。