pythonpycodestyle

"ModuleNotFoundError: No module named 'pycodestyle'"


I have installed pycodestyle on my mac in the same path using

pip install pycodestyle

but when I check for its version I get-

    "pycodestyle" --version
Traceback (most recent call last):
  File "/Users/shashwatkhilar/tools/bin/pycodestyle", line 6, in <module>
    from pycodestyle import _main
ModuleNotFoundError: No module named 'pycodestyle'

Solution

    1. Create a project directory demo
    2. change directory to the project directory
    3. create a virtual environment myenv
    4. Activate the virtual environment.
    5. Install pycodestyle
    mkdir demo
    cd demo
    python3 -m venv myen
    source myenv/bin/activate
    pip install pycodestyle
    

    Check whether it is installed or not using any of these commands

    pip freeze
    

    or

    pycodestyle --version