简体   繁体   中英

Converting Python program with command line argument into executable using PyInstaller

I would like to convert a python code with command line argument into windows executable using pyInstaller. I run my python program as follows

python myPython 1

Firstly i wonder that you don't get articles related to to this in your Google search.

First Install pyinstaller by running this command

pip install pyinstaller

For Additional Help https://pyinstaller.readthedocs.io/en/stable/installation.html

Open command prompt, Now navigate to the directory in which your python file (using the cd command ) is located then enter the code

pyinstaller --onefile .py

This will create a standalone executable file (That i expect you are asking). Below is the link to a stackoverflow question you missed to read. Edit : in the same directory a folder name dist will get created which have your single executable.

How can I convert a .py to .exe for Python?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM