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
venv
with a Name suffixed with version number - Activate this
venv
- Install packages from
PyPy
cd
into a couple of local packages folders- Install them by
git install .
cp
a 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?