我正在使用PyInstaller将此代码转换为.exe:
import arabic_reshaper
(这是一个用于在pygame,Kivy等中显示阿拉伯或波斯字母的模块)
当我在cmd中运行PyInstaller --name test test.py
时,它将毫无问题地生成.exe文件。但是之后,当我运行.exe文件时,它不起作用:
test\dist\test\arabic_reshaper\default-config.ini not found
我在github中看到了this issue,并将““ test.spec”“中的Analysis变量更改为:
a = Analysis(['test.py'],
pathex=['E:\\Python\\execute test',E:\Python\Lib\site-packages],
binaries=[],
datas=[ (
pkg_resources.resource_filename('arabic_reshaper', 'default-config.ini'),
'arabic_reshaper'
),],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
然后重建文件:PyInstaller test.spec
但是当我输入我的.exe文件时,它仍然不起作用!
您能解释一下问题到底出在哪里吗?如果我以错误的方式更改了“ test.spec”文件?