简体   繁体   中英

What does it mean to be "on path" while installing Python packages?

I was installing a pylint version for Django and the tutorial states:

Ensure pylint-django is installed and on your path and then execute:

pylint --load-plugins pylint_django [..other options..]

I initially installed pylint using $ pip install pylint . But when I execute $ pylint --load-plugins pylint_django it throws up an error saing that 'pylint' is not recognized as an internal or external command, operable program or batch file.

Why is this happening?

There are two questions here. One is what is PATH and why is it needed, the other is why is pylint not working and although related they have different answers. I will explain both.

First you have to understand the concept of PATH. Whenever you type a command(let's say you typed command ) in cmd in Windows or in a terminal in MacOS or Linux OS, what you are really saying is execute a program with the name command .

Now the OS cannot possibly look at all the secondary storage devices to find a program with the same name. That would take a long time and there might be multiple programs with the same name. So, it has a list of directories where it looks for that program. This list of directories are known as the PATH.

If you are executing the command pylint then you are telling Windows to run a program of the name pylint that exists in one of the directories in the PATH. Windows tries to do that but can't find anything that exists with that name in its list of PATH directories. So, it gives you that error. You can see your windows PATH like explained here .

All python modules are added in the same directory that should exist in the PATH already. So the reason pylint command is not working is probably something else.

The other problem is why pylint is not working. I think the reason for that is you should execute

pip install pylint-django

and not

pip install pylint

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM