How to convert a python project (pycharm) into exe file - python

I've made a game Alien_Invasion using PyCharm IDE and pygame, and I want to convert all the project into an .exe file to be able to run the game on machines which doesn't have python or pygame.
I've tried pyinstaller but when it converts the main python file and I run it and it doesn't work.
Here is the link for my project:
https://drive.google.com/drive/folders/1-1gv4zRb-ZTK8NXEKPu7GSYxsownvJ-A?usp=sharing

Related

Converting a python file into executable file

I build a simple bouncing ball game using python and kivy and the game is working properly without any errors. To add Gui I have used .kv file. Then I converted the Python file into an executable file using the pyinstaller module to convert the .py file I have used the statement pyinstaller -F PingPong.py
It has generated the .exe file but when I run the .exe file it just opens a black window and gets closed after few second.
Can anyone please tell me why is it behaving like this and how to convert the .py into .exe
Thank you!

Making exe file with the help of pyinstaller

I wrote my GUI calculator with Python and Tkinter and now I'm trying to make exe file from my .py file. I'm using pyinstaller to do this, but when i compile my file and try to open it i get this error
But my program perfectly work when i run it in Pycharm. So, I just don't know what to do.
My code:https://github.com/Unknown-reader/Python-Calculator/blob/master/ffff.py

Pick up directory with pyinstaller

I have made a small programm with Python 3 and Qt-Designer using Pyqt5.
the programm should open a pdf file which is located on a directory on my pc and another exe file, which is also on my pc.
I'm using in the code:
os.startfile("D:\Python_files\MA\Programm\K_file\dist\K_D\K_D.exe")
os.startfile("D:\Python_files\MA\Programm\Help.pdf")
then I used pyinstaller to make it standalone app. The problem is that pyinstaller does not pick up those two file (pdf and exe). So when somebodyelse download the app on thier pc, it wont work because the pdf and the exe are missing.
How to fix this?
I'm using this command in pyinstaller
pyinstaller --onefile --icon="if_icon_64682.ico" --clean ProgV_1_6_Final.py

Issue in converting python file to an executable using cx_freeze

I have been working on a python GUI based project using PyQt5. I am done with that and it runs perfectly on my PC but I want to make an executable out of it. So, i'm using cx_freeze to convert my python file to an executable. I have python version 3.5 and PyQt5.
When I build the script the build folder is made and when I run the executable it get the missing modules error as shown in the image attached.
Kindly, help me out i am stuck on this for ages now.
Copy all the modules in the same directory as the file you are converting to exe, then try it again.

Import python modules from the same directory as the script running

I have a task from school to make a simple adventure game in python. In order for the teachers to see my program, I have to run my python script on the school computers. I want to use pygame in my program. The problem is that student accounts have very limited access. We cannot modify local directories, environment paths or run .exe files. This is a problem because I cannot install the pygame module on the computer. My only choice is to somehow include pygame in the same directory as the main python script that will be run.
Is there a way to use the pygame modules without using pip or easy_install and just include pygame in the same directory as the game itself?
If you can get the teacher to give you permission to run .exe (maybe they can enter administrator password for you at runtime?), you could create a .exe with PyInstaller (see https://stackoverflow.com/a/36456473/6167592) with your game. It bundles all the libraries and depedencies into the .exe, so you don't need to install Python on the school computer. Also have your .py files handy to show your code to the teacher. Note that you need Python to use PyInstaller, so you won't be able to change your code and remake a .exe once at school.

Categories

Resources