简体   繁体   English

Python脚本可执行文件与py2exe或pyinstaller

[英]Python script executable with py2exe or pyinstaller

My program contains 3 files (2x .py and .json). 我的程序包含3个文件(2x .py和.json)。 I would like to make single exe file. 我想制作单个exe文件。 I tried py2exe with basic setup settings: 我尝试了基本设置设置的py2exe:

from distutils.core import setup
import py2exe

setup(console = ['my_main_file.py'])

It doesn't work. 它不起作用。 When I run exe file from dist directory terminal window blinks for a second. 当我从dist目录终端窗口运行exe文件时闪烁一秒钟。 I tried also pyinstller but result is similar. 我也试过pyinstller,但结果是类似的。 How can I make it? 我该怎么做?

I solved it! 我解决了! I launched my .exe file from terminal and received an error "there is no file myfile.json" or something like that. 我从终端启动了我的.exe文件并收到错误“没有文件myfile.json”或类似的东西。 I simply copied this file to disc directory and program works. 我只是将此文件复制到光盘目录并且程序正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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