【问题标题】:pyinstaller executable doesn't run in Ubuntu 18.04.1pyinstaller 可执行文件无法在 Ubuntu 18.04.1 中运行
【发布时间】: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


    【解决方案1】:

    尝试像这样运行它:./mytest

    如果您指定文件的相对路径,Bash 只会查找当前目录。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-21
      • 1970-01-01
      • 2021-09-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-12
      • 2020-10-29
      相关资源
      最近更新 更多