Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

-bash: pylint: command not found

I have been trying to install pylint to be used on terminal, but have been unsuccessful in using it. The installation gets successful, but whenever I try to run pylint command, it returns the following error -

-bash: pylint: command not found

I have tried using following commands -

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

I have uninstalled it, before trying each of the above command, but everytime I install it, the installation gets successful, but I am unable to use it on command line. I know it's something silly I am missing.

Here's the output I get on installation -

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: I am using macOS Sierra 10.12.3 on a Macbook pro Late 2011, in case this is relevant.

like image 734
noob Avatar asked Apr 12 '17 14:04

noob


People also ask

How do I enable Pylint?

Enable linting# To enable linters, open the Command Palette (Ctrl+Shift+P) and select the Python: Select Linter command. The Select Linter command adds "python. linting. <linter>Enabled": true to your settings, where <linter> is the name of the chosen linter.

How do you add Pylint?

To install Pylint, run the following command: pip3 install pylint. If python --version returned 3. x.x , run: pip install pylint.


1 Answers

The issue is installed python executables aren't being added to your path. Our paths don't look exactly the same (probably because different python versions, I'm not sure) but mine is

host:~ williamhammond$ pip install pylint
Requirement already satisfied: pylint in /Users/williamhammond/Library/Python/3.7/lib/python/site-packages (2.3.1)
Requirement already satisfied: astroid<3,>=2.2.0 in /Users/williamhammond/Library/Python/3.7/lib/python/site-packages (from pylint) (2.2.5)
Requirement already satisfied: isort<5,>=4.2.5 in /Users/williamhammond/Library/Python/3.7/lib/python/site-packages (from pylint) (4.3.21)
Requirement already satisfied: mccabe<0.7,>=0.6 in /Users/williamhammond/Library/Python/3.7/lib/python/site-packages (from pylint) (0.6.1)
Requirement already satisfied: wrapt in /Users/williamhammond/Library/Python/3.7/lib/python/site-packages (from astroid<3,>=2.2.0->pylint) (1.11.2)
Requirement already satisfied: six in /Users/williamhammond/Library/Python/3.7/lib/python/site-packages (from astroid<3,>=2.2.0->pylint) (1.12.0)
Requirement already satisfied: typed-ast>=1.3.0; implementation_name == "cpython" in /Users/williamhammond/Library/Python/3.7/lib/python/site-packages (from astroid<3,>=2.2.0->pylint) (1.4.0)
Requirement already satisfied: lazy-object-proxy in /Users/williamhammond/Library/Python/3.7/lib/python/site-packages (from astroid<3,>=2.2.0->pylint) (1.4.1)

I was seeing the same issues as you until I looked here

host:~ williamhammond$ ls /Users/williamhammond/Library/Python/3.7/bin/
dmypy           epylint         isort           mypy            pep8            pylint          pyreverse       stubgen         symilar

Once you add this to your path like

export PATH=$PATH:/Users/williamhammond/Library/Python/3.7/bin/

you should be able to use pylint. To make this change permanent make sure to add the command to your ~/.bashrc

like image 65
William Hammond Avatar answered Oct 25 '22 08:10

William Hammond