Sunday, July 10, 2022

[SOLVED] Installing a python 3.7 virtual environment on a Linux machine with python 2.7

Issue

I wonder how I can install a python 3.7 virtual environment on a Linux machine that currently has python 2.7? I also do not have sudo privilege.

id='dv3'>

Solution

I have found a way to do this with conda:

First, install conda in your Linux account:

$ cd ~
$ wget https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh
$ bash Anaconda3-2020.11-Linux-x86_64.sh
$ source ~/.bashrc
$ conda update --all

Then create a virtual environment with conda while specifying Python version:

$ conda create -n myenv python=3.7
$ conda activate hou-env

After that, running python -V in the command line will return Python 3.7.13



Answered By - Kaihua Hou
Answer Checked By - Pedro (WPSolving Volunteer)