poetry change python version to 3.x
Whenever you change dependencies by hand in your pyproject.toml
you have to take care of these points:
Run
poetry lock
afterwards or remove thepoetry.lock
file to force recreation of it. The reasons for this is, thatpoetry install
takes thepoetry.lock
as input if can find one and not thepyproject.toml
.If you change the python version and uses in-project virtualenv, remove the
.venv
before runningpoetry install
. poetry doesn't change the python version of a venv once it is created, because it uses the python version itself to create the virtualenv.
I had the same problem. I solve it by fixing the first line in the file /home/nordman/.poetry/bin/poetry
(nordman
is my local name).
Just change #!/usr/bin/env python
to #!/usr/bin/env python3
You can change in pyproject.toml and execute de this command "poetry env use 3.x" that works for me.