pyinstaller打包报错AttributeError: 'NoneType' object has no attribute 'get_filename'

问题

可以直接运行脚本, 但是用pyinstaller打包会报错

环境

python 3.6.8

Faker 13.3.3

pip 21.3.1

pyinstaller 4.10

pyinstaller-hooks-contrib 2022.0

报错

Traceback (most recent call last):

File "<string>", line 2, in <module>

ModuleNotFoundError: No module named 'text_unidecode'

Traceback (most recent call last):

File "/root/ddcw_bench/venv/lib/python3.6/site-packages/PyInstaller/utils/hooks/__init__.py", line 366, in get_module_file_attribute

attr = loader.get_filename(package)

AttributeError: 'nonetype' object has no attribute 'get_filename'

解决办法

咋一看是loader没得get_filename, 但是你在这代码前加一个 print(dir(loader)), 会发现有get_filename....

其实上面还有个报错是 No module named 'text_unidecode'

所以只需要安装下text_unidecode就行

pip install text_unidecode

其实这个算小坑吧.....

相关文章

显卡天梯图2024最新版,显卡是电脑进行图形处理的重要设备,...
初始化电脑时出现问题怎么办,可以使用win系统的安装介质,连...
todesk远程开机怎么设置,两台电脑要在同一局域网内,然后需...
油猴谷歌插件怎么安装,可以通过谷歌应用商店进行安装,需要...
虚拟内存这个名词想必很多人都听说过,我们在使用电脑的时候...