我已经使用python 3.9.7
版本在MacOS BigSur 11.6上建立了一个虚拟环境。
环境名称为“ambiente”,这是终端的外观:
(ambiente) mac.fede@Ahoga PageDownloader %
我在PageDownloader
目录中。
在这个文件夹中有我的python项目。
我可以使用:python3 PageDownloader.py
运行该程序,并且一切正常
我尝试使用PyInstaller
安装并运行它,UNIX可执行文件工作正常
然后,我使用Platypus
将其封装到应用程序中,当双击图标时,将运行一个shell脚本并启动以前获得的UNIX可执行文件
当我双击应用程序时,这是输出:
initializing script //this launches PageDownloader Executable file
Python path configuration:
PYTHONHOME = '/Users/mac.fede/Documents/GitHub/PageDownloader/PageDownloader.app/Contents/Resources'
PYTHONPATH = (not set)
program name = '/Users/mac.fede/Documents/GitHub/PageDownloader/PageDownloader.app/Contents/Resources/PageDownloader'
isolated = 0
environment = 0
user site = 0
import site = 0
sys._base_executable = '/Users/mac.fede/Documents/GitHub/PageDownloader/PageDownloader.app/Contents/Resources/PageDownloader'
sys.base_prefix = ''
sys.base_exec_prefix = ''
sys.platlibdir = 'lib'
sys.executable = '/Users/mac.fede/Documents/GitHub/PageDownloader/PageDownloader.app/Contents/Resources/PageDownloader'
sys.prefix = ''
sys.exec_prefix = ''
sys.path = [
'/Users/mac.fede/Documents/GitHub/PageDownloader/PageDownloader.app/Contents/Resources/base_library.zip',
'/Users/mac.fede/Documents/GitHub/PageDownloader/PageDownloader.app/Contents/Resources/lib-dynload',
'/Users/mac.fede/Documents/GitHub/PageDownloader/PageDownloader.app/Contents/Resources',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'
Current thread 0x000000010c0cfe00 (most recent call first):
<no Python frame>
StackOverflow上的其他帖子如下:Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding, when trying to start uwsgi
建议删除PYTHONHOME环境变量,但我不知道怎么做。我可以看出它已经设置好了,不应该设置。我在互联网上做了一些研究,但我不知道如何在Mac上做这件事。我已经试过了:
unset PYTHONPATH
unset PYTHONHOME
在启动可执行文件之前,发生了相同的错误。 现在,我不知道这是否是从MacOS上的python程序创建可导出应用程序的正确方法,我正试图弄明白这一点,所以所有这些解决方案都是“自制的”。如果你有任何建议,我将非常高兴听到
“可导出”是指我可以与朋友或其他人共享的应用程序,双击即可运行
目前没有回答
相关问题 更多 >
编程相关推荐