简体   繁体   中英

Install python package for python2.7 with pip

I am trying to install pre-commit for python2.7 with pip 8.1.2.

If i do pip install --user pre-commit or ´python -m pip install --user pre-commit´ it keeps trying to load pre-commit3.0.2 and failing.

So i tried to find the most recent version that still supports python2.7 (by manually going through the version history, is there not better way?) and that is 1.21.0.

But even when i do pip install --user pre-commit==1.21.0 it fails due to

Collecting virtualenv>=15.2 (from pre-commit==1.21.0)
  Using cached https://files.pythonhosted.org/packages/7b/19/65f13cff26c8cc11fdfcb0499cd8f13388dd7b35a79a376755f152b42d86/virtualenv-20.17.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-mjJnKQ/virtualenv/setup.py", line 4, in <module>
        raise RuntimeError("setuptools >= 41 required to build")
    RuntimeError: setuptools >= 41 required to build

which i assume is because virtualenv-20.17.1 requires python3

Yes, I think pre-commit is not supported for Python 2.7 and starts only in 3.7 but you can write a custom hook or any other tools that you are using for linting based on the IDE you are using.The hook would need to check for any errors in the code before committing, and if any errors are found, it should fail the commit and display a warning message.

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