2

I have Python 2.7 & 3.5 on my system. I'm using OS X 10.12. Python 2.7 is the default on the system.

When building PyInstaller using...

pyinstaller myscript.py

...PyInstaller uses Python 2.7.

Perhaps I missed it, but I can't find anywhere in PyInstaller documentation that would allow me to specify the Python version.

Does anyone know how constrain PyInstaller to use the non-default Python version 3.5?

I've tried building using Macports.

After using command....

sudo port select python python35

I get a confirmed...

Selecting 'python35' for 'python' succeeded. 'python35' is now active.

Then when trying to build using...

pyinstaller main.py --onefile 

PyInstaller shows it's building with 2.7...

68 INFO: PyInstaller: 3.2.1
68 INFO: Python: 2.7.13

Where am I going wrong?

Emily
  • 2,129
  • 3
  • 18
  • 43

2 Answers2

2

When installing pyinstaller use pip3 install pyinstaller

Adam
  • 131
  • 7
0

I solved a similar problem on Windows(10) using venv: https://docs.python.org/3/library/venv.html

I first installed the version of python (3.5.2), that I thought would work with PyInstaller (3.2.1). Then I created a virtual environment. Next I activated that venv. Installed pyinstaller and ran pyinstaller.

It made my executable ok, whereas PyInstaller: 3.2.1 failed miserably with Python: 3.6.1.

Here is some pseudo cmd line commands, but you get the idea from reading the URL above.

Python35-32\python -m venv <venvpath>
cd <venvpath>
.\Scripts\activate
pip install PyInstaller
pyinstaller -F -c buildtest.py
ant
  • 103
  • 1
  • 5