0

I use a virtualenv to pip install packages. To run my script, I need the command:

command = "env/bin/python main.py"

If I type the command in the terminal directly, it is working. However, if I run it in

os.system(command)

The script is stopped and feedback "xxx is not found". I checked that in the latter case, the used python is not the one in the virtualenv, but the one in the system.

BTW: The suggested answer does not solve my problem.

hengyue li
  • 448
  • 3
  • 17
  • 1
    Possible duplicate of [Activate a virtualenv with a python script](https://stackoverflow.com/questions/6943208/activate-a-virtualenv-with-a-python-script) – phd Nov 30 '18 at 07:16
  • https://stackoverflow.com/search?q=%5Bvirtualenv%5D+activate+subprocess – phd Nov 30 '18 at 07:16

0 Answers0