I made my second program in Python. It's a program that calculates the roots of a quadratic equation. I think it's cool and I want to let my friends use it without having to let them install python.
I heard about Pyinstaller from a friend and I tried this method out: first I typed pip install pyinstaller
in cmd. Then I changed directory to the folder that contains the file that I want to share with my friends (it's called vkv.py
). Then I entered this command: pyinstaller vkv.py
but I got this error: Indexerror: tuple index out of range
. Apparently the problem was that I have Python 3.6.0 and Pyinstaller only works with versions up to Python 3.5.
So I had to try another method. Yesterday, I tried cx_Freeze and some other method that I forgot, but both of them failed. Cx_Freeze failed due to me having Python 3.6.0 (same as Pyinstaller) and I don't remember what went wrong with the other method.
My friend (who told me about Pyinstaller) told me to use virtualenv, so I looked up a tutorial on the matter. Looks like I needed to make a virtual environment where I use Python 3.5. So these are the commands that I typed in cmd:
-
pip install virtualenv
-
mkdir Environments
-
cd environments
-
virtualenv -p C:\Users\hp\AppData\Local\Programs\Python\Python35\python.exe py35_env
(before entering this command, I installed Python 3.5.0)
-
C:\Users\hp\Environments\py35_env\Scripts\activate
pip install pyinstaller
. Then I changed directory to: C:\Users\hp\Desktop\Code\Python testing
(which is where the vkv.py file is located at). Then I typed: pyinstaller vkv.py
, but now I got a whole bunch of lines, with an error on the last line: ImportError: DLL load failed: %1 is not a valid Win32 application.
. Here is a screenshot of it: 
Being the curious person that I am, I wanted to know what would happen if I opened another cmd window and tried Pyinstaller again without the environment (so I basically tried the very first method again, listed above). It is strange that I got the same "ImportError" and not the "IndexError" from before.
So now my questions are (ranked from more important to less important):
- what can I do to let my friends run the Python file without having to install Python?
- What does this ImportError mean and how can I fix it?
- What happened there with the last time that I tried
pyinstaller vkv.py
in cmd outside of the environment? Why did it give me an ImportError and not the IndexError, which is what I got when I first tried to run this command?
Sorry to make this a long post, but I like to give a lot of information because I'm afraid that I might leave something important out.
Thanks in advance for any kind of help!