0

I've just got a backend repository to launch locally. It uses poetry for the dependencies and has this specified python = ">=3.7,<3.8".

  • python -V -> Python 2.7.16
  • python3 -V -> Python 3.8.5
  • which python -> /usr/local/bin/python
  • which python3 -> /usr/local/bin/python3

I've installed pyenv using brew and installed 3.7.8 (which is now visible when running pyenv versions).

Running poetry shell throws me:

The currently activated Python version 3.8.5 is not supported by the project (>=3.7,<3.8).

And when trying to poetry env use 3.7.8 it returns:

/bin/sh: python3.7: command not found

My question is – how can I setup python3.7 command on my macOS?

0

1 Answer 1

4

It looks like there's no python3.7 executable linked explicitly by pyenv on your path.

You should enable 3.7.8 as the local version for your project by running: pyenv local 3.7.8 inside the project directory.

You could also tell poetry to use it directly by passing poetry env use the full executable path (not just the version string).

Sign up to request clarification or add additional context in comments.

2 Comments

I've run pyenv local 3.7.8 in the repo directory (it created .python-version file) – didn't help :(
I've tried adding eval "$(pyenv init -)" to my ~/.bash_profile but I forgot about using ~/.zshrc. Adding the line there made the command (python3.7) work!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.