├── LICENSE
├── Output
└── GUI.exe
├── README.md
├── README_image
├── Banner.png
├── install_complete.png
├── install_ques.png
├── installing.png
└── testing.png
├── asset
└── icon.ico
├── create.exe
├── create.py
├── module
├── .DS_Store
├── Python_Kernal_download.exe
├── main.c
├── main.dll
├── main.pyw
├── process_interpreter.exe
├── process_interpreter_py.exe
└── run.exe
└── setting.iss
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License with Commercial Use Restriction
2 |
3 | 저작권 (c) 2024 Inc.Diddmstjr
4 |
5 | 이번 소프트웨어 및 관련 문서 파일 (이하 'PyEXE')의 사본을 획득한 모든 사용자에게 다음과 같은 권한을 부여합니다.
6 |
7 | 이 소프트웨어를 수정, 병합, 게시, 배포하는 등의 비상업적 용도로 사용할 수 있습니다. 그러나 상업적 용도로 이용하는 것은 금지됩니다.
8 |
9 | 소프트웨어를 사용하는 경우, 반드시 원 저작자에게 연락하여 상업적인 용도로 사용할 수 있는 허가를 받아야 합니다.
10 |
11 | 본 소프트웨어는 상품성, 특정 목적에의 적합성 및 비침해에 대한 보증을 포함하여, 어떠한 종류의 명시적이거나 묵시적인 보증 없이 "있는 그대로" 제공됩니다. 제작자나 저작권자는 어떠한 경우에도 소프트웨어나 소프트웨어 사용으로 인한 청구, 기타 책임에 대해 책임지지 않습니다.
12 |
13 | MIT 라이선스 전문은 다음과 같습니다.
14 |
15 | The MIT License (MIT)
16 |
17 | Copyright (c) 2024 Inc.Diddmstjr
18 |
19 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
20 |
21 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
22 |
23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 |
--------------------------------------------------------------------------------
/Output/GUI.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/diddmstjr07/PyEXE/58b21635fa634bbe1f9e7653c76f22a909d35fa9/Output/GUI.exe
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Finally, a program has been developed that can automatically download the Python interpreter. (Powershell code)
This program was created to complement the problem previously developed .py to exe. Previously python converting Program that only supports converting, obviously it was hard to publishment python program to non-programer. To support this problem, I add function, "Auto Python Interpreter Download".
This function Downloads Python Interpreter automatically also sets environment variables. After process finishes, your python files are located to Program Files (x86), can be search by Windows Search Engine. Lastely, PyEXE supports Non-Limited program files. If files are connected by import or subprocess, you can select all files to process together in program.
main.py to main.c connection way -> if your python code uses C languages, you should use "ctypes" module
10 | 11 | import ctypes 12 | 13 | function = ctypes.CDLL('./main.dll') 14 | fuction.main() 15 | 16 |"function.main()" -> main should be inner function in C file.
After you complete writing you should Compile C file to make Share Library
To find more information about gcc compiler, "https://gcc.gnu.org/onlinedocs/"
22 | 23 |Module Packaging Method -> module name should be located between [' ']
24 | 25 | import subprocess 26 | 27 | packages = [''] 28 | for package in packages: 29 | try: 30 | subprocess.run(['C:\Program Files\Python310\Scripts\pip.exe', 'install', package, '-q'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) 31 | except: 32 | subprocess.run(['pip', 'install', package, '-q'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) 33 | 34 |The following is the content translated into Korean from the description above
53 |드디어, 자동으로 Python 인터프리터를 다운로드할 수 있는 프로그램이 개발되었습니다. (PowerShell 코드)
이 프로그램은 이전에 개발된 .py를 .exe로 변환하는 문제를 보완하기 위해 만들어졌습니다. 이전에는 Python 변환 프로그램이 변환만 지원하는데, 이는 비프로그래머들에게 Python 프로그램을 배포하기 어려웠습니다. 이 문제를 해결하기 위해 "자동 Python 인터프리터 다운로드" 기능을 추가했습니다.
이 기능은 Python 인터프리터를 자동으로 다운로드하고 환경 변수를 설정합니다. 프로세스가 완료되면 Python 파일이 Program Files (x86)에 위치하게 되며, Windows 검색 엔진에서 검색할 수 있습니다. 마지막으로, PyEXE는 파일 개수에 제한이 없는 변환을 지원합니다. 파일이 import 또는 subprocess로 연결된 경우 프로그램에서 함께 처리할 모든 파일을 선택할 수 있습니다.
main.py에서 main.c로의 연결 방법 -> 프로그램의 Python 코드중 C 언어를 필요로 한다면, "ctypes" 모듈을 사용해야 합니다.
61 | 62 | import ctypes 63 | 64 | function = ctypes.CDLL('./main.dll') 65 | function.main() 66 | 67 |"function.main()" -> main은 C 파일 내의 내부 함수여야 합니다.
작성을 완료한 후 C 파일을 컴파일하여 공유 라이브러리를 만들어야 합니다.
gcc 컴파일러에 대한 자세한 정보는 "https://gcc.gnu.org/onlinedocs/"에서 확인할 수 있습니다.>
73 |모듈 패키징 방법 -> 모듈 이름은 [' '] 사이에 위치해야 합니다.
74 | 75 | import subprocess 76 | 77 | packages = [''] 78 | for package in packages: 79 | try: 80 | subprocess.run(['C:\Program Files\Python310\Scripts\pip.exe', 'install', package, '-q'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) 81 | except: 82 | subprocess.run(['pip', 'install', package, '-q'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) 83 | 84 |This step involves downloading the Python interpreter and setting environment variables using Powershell.
123 | 124 | --- 125 | 126 |Finally, we can see alert window saying installed version of python.
133 | 134 | --- 135 | 136 |Testing python command in Command Prompt.
138 | -------------------------------------------------------------------------------- /README_image/Banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diddmstjr07/PyEXE/58b21635fa634bbe1f9e7653c76f22a909d35fa9/README_image/Banner.png -------------------------------------------------------------------------------- /README_image/install_complete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diddmstjr07/PyEXE/58b21635fa634bbe1f9e7653c76f22a909d35fa9/README_image/install_complete.png -------------------------------------------------------------------------------- /README_image/install_ques.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diddmstjr07/PyEXE/58b21635fa634bbe1f9e7653c76f22a909d35fa9/README_image/install_ques.png -------------------------------------------------------------------------------- /README_image/installing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diddmstjr07/PyEXE/58b21635fa634bbe1f9e7653c76f22a909d35fa9/README_image/installing.png -------------------------------------------------------------------------------- /README_image/testing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diddmstjr07/PyEXE/58b21635fa634bbe1f9e7653c76f22a909d35fa9/README_image/testing.png -------------------------------------------------------------------------------- /asset/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diddmstjr07/PyEXE/58b21635fa634bbe1f9e7653c76f22a909d35fa9/asset/icon.ico -------------------------------------------------------------------------------- /create.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diddmstjr07/PyEXE/58b21635fa634bbe1f9e7653c76f22a909d35fa9/create.exe -------------------------------------------------------------------------------- /create.py: -------------------------------------------------------------------------------- 1 | import os 2 | import re 3 | import subprocess 4 | import requests 5 | import colorama 6 | from colorama import Fore, Style 7 | 8 | colorama.init() 9 | 10 | def install_packages(): 11 | """Install required packages.""" 12 | packages = ['requests', 'colorama'] 13 | for package in packages: 14 | subprocess.run(['pip', 'install', '-q', package]) 15 | 16 | def clear_console(): 17 | """Clear the console.""" 18 | os.system('cls' if os.name == 'nt' else 'clear') 19 | 20 | def prompt_language(): 21 | """Prompt the user to set language.""" 22 | print(Fore.YELLOW + "\nPYTHON EXE AUTOMATIC COMPILER Ver 2.0\n") 23 | print("© 2024. Diddmstjr Inc. All rights reserved.\n" + Style.RESET_ALL) 24 | while True: 25 | language = input(Fore.GREEN + "Please Set Language(Korean/English): " + Style.RESET_ALL).strip().lower() 26 | if language in ['korean', 'english']: 27 | return language 28 | print(Fore.RED + "Invalid input. Please type 'Korean' or 'English'." + Style.RESET_ALL) 29 | 30 | def main(): 31 | """Main function to drive the script.""" 32 | install_packages() 33 | clear_console() 34 | language = prompt_language() 35 | 36 | if language == 'korean': 37 | clear_console() 38 | korean_version() 39 | else: 40 | english_version() 41 | 42 | def korean_version(): 43 | gui_version = input(Fore.GREEN + "->" + Style.RESET_ALL + " 터미널을 활용한 프로그램, 일반 사용자를 위한 GUI 버전(1, 2): ").strip() 44 | language_count = input(Fore.GREEN + "->" + Style.RESET_ALL + " 변환할 언어의 개수를 입력하여 주십시오: ").strip() 45 | extensions = input(Fore.GREEN + "->" + Style.RESET_ALL + " 윈도우용 실행 파일로 변환할 프로그램 언어 확장자명을 입력하여 주십시오 (2개 이상일 경우 띄어쓰기로 명시하여 주십시오): ").strip() 46 | app_name = input(Fore.GREEN + "->" + Style.RESET_ALL + " 어플리케이션 이름을 입력하여 주십시오: ").strip() 47 | app_version = input(Fore.GREEN + "->" + Style.RESET_ALL + " 어플리케이션 버전을 입력하여 주십시오: ").strip() 48 | author_name = input(Fore.GREEN + "->" + Style.RESET_ALL + " 저작권자의 이름을 입력하여 주십시오: ").strip() 49 | author_website = input(Fore.GREEN + "->" + Style.RESET_ALL + " 저작권자의 사이트를 입력하여 주십시오: ").strip() 50 | process_files = input(Fore.GREEN + "->" + Style.RESET_ALL + " 실행할 파일명을 띄어쓰기로 구분하여 입력하여 주십시오: " + Style.RESET_ALL).strip() 51 | 52 | try: 53 | if int(language_count) != len(extensions.split()): 54 | raise ValueError("\nTyped extension amount and language amount doesn't coincide\n") 55 | except ValueError as e: 56 | print(Fore.RED + str(e) + Style.RESET_ALL) 57 | return 58 | 59 | iss_content = generate_iss_content(app_name, app_version, author_name, author_website, process_files, extensions) 60 | with open('setting.iss', 'w') as file: 61 | file.write(iss_content) 62 | 63 | print(Fore.GREEN + "\n✔ ISS 파일이 성공적으로 생성되었습니다 ✔" + Style.RESET_ALL) 64 | convert_iss_to_exe() 65 | 66 | def english_version(): 67 | """English version of the program.""" 68 | gui_version = input(Fore.GREEN + "-> Console usage program, Non-Console Usage program -> GUI user version(1, 2): " + Style.RESET_ALL).strip() 69 | language_count = input(Fore.GREEN + "-> Please type your Program Language amount to convert: " + Style.RESET_ALL).strip() 70 | extensions = input(Fore.GREEN + "-> Please type your Program Language extension name to convert as Windows program(exe) (If extension name is more than 2, please envince as space.): " + Style.RESET_ALL).strip() 71 | app_name = input(Fore.GREEN + "-> Please type application name: " + Style.RESET_ALL).strip() 72 | app_version = input(Fore.GREEN + "-> Please type application version: " + Style.RESET_ALL).strip() 73 | author_name = input(Fore.GREEN + "-> Please type copywriter name: " + Style.RESET_ALL).strip() 74 | author_website = input(Fore.GREEN + "-> Please type copywriter homepage: " + Style.RESET_ALL).strip() 75 | process_files = input(Fore.GREEN + "-> Please type process file name envince as space: " + Style.RESET_ALL).strip() 76 | try: 77 | if int(language_count) != len(extensions.split()): 78 | raise ValueError("Typed extension amount and language amount doesn't coincide") 79 | except ValueError as e: 80 | print(Fore.RED + str(e) + Style.RESET_ALL) 81 | return 82 | iss_content = generate_iss_content(app_name, app_version, author_name, author_website, process_files, extensions) 83 | with open('setting.iss', 'w') as file: 84 | file.write(iss_content) 85 | print(Fore.GREEN + "\n✔ ISS File Successfully Created ✔" + Style.RESET_ALL) 86 | convert_iss_to_exe() 87 | 88 | def generate_iss_content(app_name, app_version, author_name, author_website, process_files, extensions): 89 | """Generate the content for the ISS file.""" 90 | return f"""[Setup] 91 | AppId={{D4268BF5-990D-48EE-97A7-88473C09CE36}} 92 | AppName={app_name} 93 | AppVersion={app_version} 94 | AppPublisher={author_name} 95 | AppPublisherURL={author_website} 96 | DefaultDirName={{autopf}}\\{app_name} 97 | ChangesAssociations=yes 98 | DisableProgramGroupPage=yes 99 | OutputBaseFilename={app_name} 100 | SetupIconFile=.\asset\icon.ico 101 | Compression=lzma 102 | SolidCompression=yes 103 | WizardStyle=modern 104 | 105 | [Languages] 106 | Name: "english"; MessagesFile: "compiler:Default.isl" 107 | 108 | [Tasks] 109 | Name: "desktopicon"; Description: "{{cm:CreateDesktopIcon}}"; GroupDescription: "{{cm:AdditionalIcons}}"; Flags: unchecked 110 | 111 | [Files] 112 | Source: ".\\module\\{process_files}"; DestDir: "{{app}}"; Flags: ignoreversion 113 | 114 | [Icons] 115 | Name: "{{autoprograms}}\\{app_name}"; Filename: "{{app}}\\{process_files}" 116 | Name: "{{autodesktop}}\\{app_name}"; Filename: "{{app}}\\{process_files}"; Tasks: desktopicon 117 | 118 | [Run] 119 | Filename: "{{app}}\\{process_files}"; Description: "{{cm:LaunchProgram,{app_name}}}"; Flags: nowait postinstall skipifsilent 120 | """ 121 | 122 | def convert_iss_to_exe(): 123 | """Convert ISS file to EXE using Inno Setup.""" 124 | iss_file_path = './setting.iss' 125 | iscc_path = 'C:\\Program Files (x86)\\Inno Setup 6\\ISCC.exe' 126 | 127 | try: 128 | subprocess.run([iscc_path, iss_file_path, '/VERYSILENT', '/NORESTART'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) 129 | print(Fore.GREEN + "\n✔ EXE 파일이 성공적으로 생성되었습니다 ('./Output/') ✔" + Style.RESET_ALL) 130 | except Exception as e: 131 | print(Fore.RED + f"Error: {str(e)}" + Style.RESET_ALL) 132 | 133 | if __name__ == "__main__": 134 | main() -------------------------------------------------------------------------------- /module/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diddmstjr07/PyEXE/58b21635fa634bbe1f9e7653c76f22a909d35fa9/module/.DS_Store -------------------------------------------------------------------------------- /module/Python_Kernal_download.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diddmstjr07/PyEXE/58b21635fa634bbe1f9e7653c76f22a909d35fa9/module/Python_Kernal_download.exe -------------------------------------------------------------------------------- /module/main.c: -------------------------------------------------------------------------------- 1 | #include