Python modules can be run with -m
for example next command for pip
python3.10 -m pip install pre-commit
It allow you to specify exact python binary to use with command (python3.10 or python3.11).
I have successfully installed pre-commit, but got next:
python3.10 -m pre-commit run
> python.exe: No module named pre-commit
python3.10 -m precommit run
> python.exe: No module named precommit
how to run pre-commit via python -m
option ?
The module name is pre_commit
, not pre-commit
(which is the name of the entry point), so you need to run
python -m pre_commit
Note the different names that can be set and do not neccessarily have to be the same:
pip install
import
from within a script or when you do python -m
setup.cfg
or an executable that is placed in the bin
folder during setup, which is a name that you can directly type in your terminal