【发布时间】:2018-11-17 07:49:21
【问题描述】:
我浏览了其他帖子,他们似乎没有解决当我尝试执行已编译的程序时什么都没有发生的具体问题。
不确定这是 Ubuntu 问题还是 python 问题...无论哪种方式,我对这两个问题都很陌生,所以我确信对此有一些简单的答案。
我写了一个简单的程序
print("hello")
input("now")
并使用 pyinstaller 将其编译为单个文件。
pyninstaller --onefile test.py 当我尝试通过在 GUI 中双击文件来运行文件时,什么都没有发生 - 没有错误,没有控制台。我检查了属性,它被标记为可执行文件。
当我尝试运行它时,我首先执行了 ls 以确保我在正确的目录中
eric@eric-linux:~/PycharmProjects/helloworld/dist$ ls
mytest test
为了运行它,我输入了
eric@eric-linux:~/PycharmProjects/helloworld/dist$mytest
并得到错误:
Command 'mytest' not found, did you mean:
command 'mtest' from deb parmetis-test
command 'pytest' from deb python-pytest
我还尝试使用 --debug 进行编译,运行时再次得到相同的结果。 我必须在 Ubuntu 中执行一些单独的操作才能运行可执行文件吗?
【问题讨论】:
标签: python python-3.x ubuntu pyinstaller