I
I
Issue2021-11-06 21:05:14
linux
Issue, 2021-11-06 21:05:14

How to run python script using virtual environment?

I want to make a simple portable program.
Created a virtual environment in the project directory using python3 -m venv /var/www/html/venv.
When running the script with start.sh specified main.py. But it runs in a linux environment. How to tell the script to use files from the project environment?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
LXSTVAYNE, 2021-11-06
@paulenot

You need to set the path to the python interpreter of the virtual environment and specify the executable file. Or first activate the environment, and then write python3 main.py

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question