pyinstaller 可执行文件在 Ubuntu 18.04.1 中没有 运行
pyinstaller executable doesn't run in Ubuntu 18.04.1
我查看了其他帖子,他们似乎没有解决我尝试执行已编译程序时什么都没有的具体问题。
不确定这是 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 到 运行 可执行文件中我必须做一些单独的事情吗?
尝试 运行 像这样:./mytest
Bash如果指定文件的相对路径,只看当前目录。
我查看了其他帖子,他们似乎没有解决我尝试执行已编译程序时什么都没有的具体问题。
不确定这是 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 到 运行 可执行文件中我必须做一些单独的事情吗?
尝试 运行 像这样:./mytest
Bash如果指定文件的相对路径,只看当前目录。