首页 > 解决方案 > 为什么从 PyInstaller for Centos 创建的单个可执行文件必须从可执行文件上方的一个文件夹运行,即“d​​ist”文件夹

问题描述

我使用 pyinstaller 在 windows 和 centos 中创建了可执行文件。我使用了 --onefile 属性,它创建了一个带有单个可执行文件的“dist”文件夹。

C:\Users\myprojects\blog> pyinstaller blog.py --onefile

在 Windows 中,我可以从“dist”文件夹中运行可执行文件。例如

C:\Users\myprojects\blog\dist>blog.exe

在 Centos 中,我无法从“dist”文件夹中运行它。我必须走出 dist 文件夹才能运行它。例如

C:/Users/myprojects/blog>dist/blog

这是什么原因?

标签: pythonpyinstaller

解决方案


推荐阅读