Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change python version for use with pyinstaller

I am trying to convert a .py file to an exe. My file, hello.py, reads:

print "Hello, World!"

I am currently trying to use pyinstaller. However when I run the command

pyinstaller hello.py

I get the error message "tuple index out of range" which I have been told means my version of python is unsupported. In particular it would seem the situation is that pyinstaller thinks I am trying to compile python 3.6 code into an exe. But I have python 2.7 and python 3.6 installed. How do I let it know that I want it to regard the code as python 2.7 code?

like image 474
Kyle Sargent Avatar asked Apr 16 '17 23:04

Kyle Sargent


1 Answers

Using Python3:

Make sure PyInstaller is installed in Python 3.x: pip3 freeze

PyInstaller==3.3.1

Then running the command:

/path/to/python3 -m PyInstaller your_script.py
like image 92
Joseph D. Avatar answered Oct 07 '22 16:10

Joseph D.