10
votes

So, the title basically covers my question. I've created a project using virtualenv, e.g. I have to

source ./env/bin/activate 

to run my script.

When I try creating an executable using:

pyinstaller --onefile <myscript.py>

None of the virtualenv packages are included; just the ones that are installed globally. I have a requirements.txt file that contains all of the modules I need. Is there a way to have pyinstaller point to that for the needed modules, or is there another way?

1

1 Answers

10
votes

As Valentino pointed out by looking at How can I create the minimum size executable with pyinstaller?

You have to run PyIntaller from inside the virtual environment:

(venv_test) D:\testenv>pyinstaller