# pytool **Repository Path**: luoguang/pytool ## Basic Information - **Project Name**: pytool - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-07-09 - **Last Updated**: 2025-07-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README sudo apt-get update sudo apt-get install python3-tk python3 ./1.py 清华大学镜像 pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple 安装pyinstaller pip install pyinstaller 打包 pyinstaller --onefile main.py ---------------------------- 使用 PyInstaller 打包 Windows 系统 假设我们有一个简单的 Python 文件 `hello.py`,内容如下: print("Hello, World!") 在命令行中,进入 `hello.py` 所在的目录,然后执行以下命令: pyinstaller --onefile hello.py `--onefile` 参数表示将所有依赖项打包成一个单独的可执行文件。执行完命令后,`PyInstaller` 会在当前目录下创建一个 `dist` 文件夹,里面包含生成的可执行文件 `hello.exe`。 Linux 系统 在 Linux 系统上,打包过程与 Windows 类似。同样在命令行中进入 `hello.py` 所在的目录,执行以下命令: pyinstaller --onefile hello.py 打包完成后,`dist` 文件夹中会生成一个名为 `hello` 的可执行文件,没有 `.exe` 扩展名。