0

I've never had this kind of problem because I'm using PyCharm and it has perfect version control.

But now I'm using flask and running it in terminal using 'flask run' command and I've just noticed that it runs on python 3.5:

.local/lib/python3.5/site-packages/

When I type python --version it says '3.6.5' but I went to this ~/.local/lib directory and noticed that there's only 2 folders: python2.7 and python3.5

When I try to update python using

sudo apt-get install python3.6

It says 'Requirement already satisfied.'

The reason I need python3.6 here because I can't run a flask app that contains an f-string.

Desiigner
  • 2,136
  • 5
  • 26
  • 47

1 Answers1

2

You can specify which runtime PyCharm should use, but in a shell (i.e. terminal), it's determined by your PATH environment variable.

For UNIX-like OS's (including MacOS and Linux), this answer is nicely detailed.

Under Windows, Technet has the answer. Scroll down to the 'Command Search Sequence' section. This answer explains it nicely.

There are two very useful commands for determining which executable is going to be called: which for UNIX-likes and where for newer versions of Windows.

Since virtualenv is being used, you should be able to run:

workon my_project_name

To use the existing virtual environment. Have a look at a virtualenv tutorial for more information.

Alex Taylor
  • 8,343
  • 4
  • 25
  • 40