-1

Is there a way to create virtual environment using python code. It would be great help if anyone can help. I need to automate creating virtual environment.As in using subprocesses or something similar

pip3 install pipenv cd /root_directory_of_project pipenv shell

Minchu
  • 1
  • 1
  • 6

1 Answers1

1
sudo apt install python3-pip
pip3 install pipenv
cd /root_directory_of_project
pipenv shell

if you want to see what modules are installed do,

pip3 freeze

do this inside the pipenv shell.

use exit to exit the pipenv shell. Anytime you want to use the virtual environment just do, pipenv shell in that directory to enter the shell again.

DontBe3Greedy
  • 564
  • 5
  • 12