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
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?
PyInstaller is installed in Python 3.x:
Then running the command:
/path/to/python3 -m PyInstaller your_script.py
Using PyInstaller, In the most simple case, set the current directory to the location of your program imports: specify the -v option to the underlying Python interpreter, causing it to If you want to run PyInstaller from within Python code use the run function of the In this step-by-step tutorial, you'll learn how to use PyInstaller to turn your Python application into an executable with no dependencies or installation required. This is great if you want to distribute applications to users who may or may not be Python developers.
First install Pyinstaller in your python2.7 version if not installed previously
py -2 -m pip install pyinstaller
and then go to your folder and
py -2 -m pyinstaller -F filename.py
How to Install PyInstaller, PyInstaller works with the default Python 2.7 provided with current Mac OS X installations. However, if you plan to use a later version of Python, or if you use any Steps to Create an Executable from Python Script using Pyinstaller. Step 1: Add Python to Windows Path. To start, you may want to add Python to Windows path . An easy way to add Python to the path is by downloading Step 2: Open the Windows Command Prompt. Step 3: Install the Pyinstaller Package.
Supposing you have
python 2.x on the path under
python2 you can do
python2 -m pyinstaller hello.py
How tell pyinstaller what version of python to use? : learnpython, My question would be, how do I tell pyinstaller which python version to use? 2 comments Specify full path to pyinstaller.exe from your python27 folder. level 2. It supports Python 2.7 and Python 3.4+ and successfully bundles the major and famous Python packages such as numpy, PyQT, Django and more. PyInstaller isn't cross-compiler, which means if you want to make a Windows executable ( .exe ), you need to run Pyinstaller on Windows, and if you want a GNU/Linux app, you do the same, etc.
PyInstaller · PyPI, PyInstaller bundles a Python application and all its dependencies into a single (#3348); In setup.py specify Python versions this distribution is compatible with. Stack Overflow Public questions and answers; Teams Private questions and answers for your team; Enterprise Private self-hosted questions and answers for your enterprise; Jobs Programming and related technical career opportunities
I ran two a couple things. If you uninstall python3, it works with python2. If you have python3 installed (and it is the primary), and have pyinstaller installed in python3, it wont work (python3 pyinstaller used). If you have python3 installed, but do not have it installed in python3 or uninstalled it (pip3 uninstall pyinstaller), pyinstaller works.
Checking the environmental variables (windows 10) PATH had python3 first. This may be the issue and may not be resolved because it is checking python3 directories first, and picks up pyinstaller for python3. pyinstaller does not check the file either (#!/usr/env/bin python2).
Unless pyinstaller puts an option relating to this issue, there may be no solution short of uninstalling pyinstaller from python3 temporarily.
note could also use py2exe, using py2exe for python2, pyinstaller for python3
Using PyInstaller to Easily Distribute Python Applications – Real , Download and install a specific version of Python; Set up pip; Set up a virtual environment; Get a copy of your code; Install dependencies. Stop for a moment and By default, PyInstaller installs to Python’s **Scripts** sub-folder, which is going to be in your system Python folder or in your virtual environment. Let’s take one of the simple applications from my upcoming book and turn it into an executable.
PyInstaller Quickstart, PyInstaller freezes (packages) Python applications into stand-alone If you have problems to get your application running, please have a look at If Things Go that PyInstaller works with Python 2.7 and 3.5—3.7, it builds smaller executables I recomend to you that read this thread, Comprehensive tutorial on Pyinstaller?.Would be help to you. By the other hand, I used py2exe, if you use py2exe is most powerfull, i left to you a setup.py of py2exe, on this setup.py you see the properties that you want to get to you app.exe.
[PDF] PyInstaller Documentation, PyInstaller bundles a Python application and all its dependencies into a single imports: specify the -v option to the underlying Python interpreter, causing. PyInstaller bundles a Python application and all its dependencies into a single package. The user can run the packaged app without installing a Python interpreter or any modules. Help keeping PyInstaller alive: Maintaining PyInstaller is a huge amount of work. PyInstaller development can only continue if users and companies provide sustainable
How to use PyInstaller to create Python executables, PyInstaller is a Python package, installed with pip ( pip install pyinstaller ). In the EXE object settings in the .spec file, set console=False . then you will need to install PyInstaller and build separate versions of the app on python -O -m PyInstaller -y -D --path="sdk/superdog" demo.py. Or, by explicitly setting the PYTHONOPTIMIZE environment variable to a non-zero value: # Unix PYTHONOPTIMIZE=1 pyinstaller myscript.py # Windows set PYTHONOPTIMIZE=1 && pyinstaller myscript.py.