0

I have created a virtual environment for my Python project and have installed my requirement.txt in it and every time my Python code ex executes it first activate my virtual environment and then run the .py code which is what I want.

I have an issue here - I want to do everything programmatically. Below are the high level steps i'm looking for : 1)pipreqs requirements.txt using py code 2)check if .txt file has changed, create a flag(1,0)
3)check if virtualenv is created 2.1 - if not created, create and install 1 and run py code 2.2 - if created - check if flag=1 then re-install 1 and run py code if flag=0 , just run py code

I'm struggling hard to achieve this. Could somebody help.

AL K
  • 23
  • 3
  • Does this answer your question? [Installing python module within code](https://stackoverflow.com/questions/12332975/installing-python-module-within-code) – JonSG Jun 10 '21 at 18:12

1 Answers1

0

maybe

pip install -r requirements.txt

is a good starting point (if your paint point is to manually install all the required libraries). It installs all the libraries listed in requirements.txt.

If this is not enough putting this command in a bash / cmd file might be an option.

Raphael
  • 1,731
  • 2
  • 7
  • 23