2017-04-12 94 views
0

我一直在試圖安裝pylint以在終端上使用,但在使用它時一直不成功。安裝獲得成功,但每當我嘗試運行pylint的命令,它會返回下面的錯誤 --bash:pylint:找不到命令

-bash: pylint: command not found 

我一直在使用下面的命令嘗試 -

pip install pylint 
python -m pip install pylint 
sudo pip install pylint 
sudo -H pip install pylint 

我已經卸載它,嘗試每前上面的命令,但每次我安裝它時,安裝都會成功,但我無法在命令行上使用它。我知道這是我失蹤的愚蠢。

這裏的輸出我得到的安裝 -

My-Mac:Dev noob$ sudo -H pip install pylint 
Collecting pylint 
    Using cached pylint-1.6.5-py2.py3-none-any.whl 
Requirement already satisfied: isort>=4.2.5 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from pylint) 
Requirement already satisfied: six in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from pylint) 
Requirement already satisfied: mccabe in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from pylint) 
Requirement already satisfied: configparser; python_version == "2.7" in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from pylint) 
Requirement already satisfied: backports.functools-lru-cache; python_version == "2.7" in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from pylint) 
Requirement already satisfied: astroid<1.5.0,>=1.4.5 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from pylint) 
Requirement already satisfied: wrapt in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from astroid<1.5.0,>=1.4.5->pylint) 
Requirement already satisfied: lazy-object-proxy in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from astroid<1.5.0,>=1.4.5->pylint) 
Installing collected packages: pylint 
Successfully installed pylint-1.6.5 

PS:我使用MacOS的塞拉利昂10.12.3在MacBook Pro上2011年末,在這情況下是相關的。

回答

0

您必須將pylint添加到PATH環境變量中。 首先檢查哪裏pylint的安裝

whereis pylint 

,然後添加返回的路徑到PATH環境變量

export PATH=$PATH:/path/returned/by/whereis