B
B
Bekkazy2019-07-16 06:34:07
Python
Bekkazy, 2019-07-16 06:34:07

How to create a Python 3.7 virtual environment when there are several versions of the interpreter in a Linux family OS?

I have python2.7, python3.5, python 3.7 installed.
pip uses python version 3.5

pip 9.0.1 from /usr/local/lib/python3.5/dist-packages (python 3.5)

The problem is that when creating a virtual environment, it is created with python 3.5, but I need python 3.7 there. How can the problem be solved?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Guest007, 2019-07-16
@Guest007

Use pyenv if you are working with different versions of Python. Well, for development it is better to use non-system Python.
So pyenv-installer and go!
you put pyenv you
write in ~/.bash_profile
you put the required version of python: pyenv install 3.7.3(or whatever you need from the list pyenv install --list)
you create a virtuality: you pyenv virtualenv 3.7.3 venv37
go to the project directory and set this virtuality by default for the directory: Voila! When changing to the project directory, the virtualenv is activated automatically. Each project has its own virtualenv and its own version of python (if necessary, of course) pyenv local venv37

D
Dimonchik, 2019-07-16
@dimonchik2013

pip3.7 install virtualenv
python3.7 -m virtualenv MyEnv

V
Vladimir Kuts, 2019-07-16
@fox_12

virtualenv -p <путь к python нужной версии> venv

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question