Fixing the "Command Not Found" Error for Pycodestyle
A quick and easy fix for this annoying problem
Pycodestyle based on the Pycodestyle website is a tool that is used to check for compatibility of your Python code style against some of the code conventions in the pep8. This pep8 coding style is taken to be the standard for how Python code should be structured, and the goal is to improve the readability of the code and make it consistent across the wide spectrum of Python code.
Installation and Set-up
Installing the Pycodestyle, most especially following the command from the Pycodestyle website itself using the pip install command might mandate you to create an isolated environment that is different from your main environment before you will be able to make use of it.
So to install it on your local machine following the installation guide on the official Pycodestyle website, one will have to make use of the pip install manager. Now in as much as this is good, it has some issues.
Due to the recent upgrades to the pip, they have now made it compulsory for you to be able to make use of any package that is been installed with the pip command, you will have to create an environment that is separate from your normal local environment, then set up whatsoever package you want to install using the pip there, only then can you use the package.
So even if you end up using this command to install the pycodestyle, you will not be able to use it in your normal environment.
To confirm, you can type the commands
So the best thing to do is to simply use the pip uninstall command, which is the last command in the image above, to remove the Pycodestyle package.
pip uninstall pycodestyle
In a situation where this command does not work, you can try the one below:
sudo apt remove pycodestyle
So to solve the problem of
zsh: command not found: pycodestyle for those using the zsh (zsh shell) or
bash: command not found: pycodestyle for those using the bash (bash shell).
You should use the command below to install the pycodestyle:
sudo apt install pycodestyle
After the installation, we can now confirm by using the commands
pycodestyle as well as
which pycodestyle to be sure it now works in our normal environment.
You can check the pycodesyle website to see how to use the command to check for code style compliance with your Python file.
You can also check the PEP 8 website for all the official guides in making your Python code compliant.
This is a quick fix but might not be the only fix, so incase this doesn't work, you can search for other solutions, but based on my experience, if you follow the guide properly, this should work for you if your challenge is the same with what is being written about.