Search code examples
pythonpippip-tools

Change Python version for pip-compile


When I run pip-compile, part of the generated file is this:

# This file is autogenerated by pip-compile with python 3.8

I suppose this is happening because I cloned a project that contained a setup.py at one point that specified Python 3.8. However, I changed a lot of the code and removed the setup.py so that no more references to Python 3.8 are present in my code, and I'm actually using Python 3.9 now. Still, even when I've activated my Python 3.9 venv in the same shell before calling, pip-compile, the line containing Python 3.8 ends up in the requirements file. How can I reconfigure pip-compile to output 3.9?


Solution

  • Pip-compile has the python version in his file

    1./ Which pip-compile do you use

    which pip-compile

    /usr/local/bin/pip-compile
    

    2./ Which python version use pip-comple

    head -1 /usr/local/bin/pip-compile

    #!/usr/local/Cellar/pip-tools/6.12.1/libexec/bin/python3.11
    

    3./ You know find the version used with pip-compile

    In my case python3.11