We want to deliver a ready-to-deploy
venv for different versions of our software.
Therefore, I wanted to write a simple Python script, which calls a couple of bash commands for installing every package we need.
So the steps are:
- Create a
venvwith a Name suffixed with version number
- Activate this
- Install packages from
cdinto a couple of local packages folders
- Install them by
git install .
cpa couple of files in the venv folder
My problem now is, I can't find a way to activate the
venv from within the script. I already read about how it was done in Python 2 (with
execfile) and about the
exec(open(path_to_env_activate).read()) in Python 3.
However, the second version for Python3 gives me a Syntax Error:
Traceback (most recent call last): File "build.py", line 32, in <module> exec(open(venv_activate).read()) File "<string>", line 1 @echo off ^ SyntaxError: invalid syntax
What did I get wrong here? Or is there kinda best practice how to install
venv with packages with a script?