Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create venv

I have been using my python v3.9 in my virtual environment, it contains all the packages and scripts i have been using for so long. But, now with the release of python v 3.10 it installed itself globally though I wanted it to be installed in same venv I was using for python v3.9 So, if anyone could help me with how can I install python v3.10 in the same venv of my v3.9 . My IDE is PyCharm

like image 377
Akash Sharma Avatar asked Jul 14 '26 23:07

Akash Sharma


1 Answers

Simply put all the dependencies of your python 3.9 (venv) in requirements.txt file

pip freeze > requirements.txt

Create a new folder then move that file inside the newly created folder then execute the following code, it will create a new virtual environment with python 3.10

python -m venv newenv

activate the newly created environment by

source newenv/bin/activate

then install the required dependencies by

pip install -r requirements.txt

Note: If your OS do not have 'venv' module then simply install it by using

pip install venv
like image 123
Md Tausif Avatar answered Jul 17 '26 17:07

Md Tausif