前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >pyinstaller打包报错AttributeError: 'NoneType' object has no attribute 'get_filename'

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

原创
作者头像
大大刺猬
发布2022-03-30 15:18:11
2.6K2
发布2022-03-30 15:18:11
举报
文章被收录于专栏:大大刺猬

问题

可以直接运行脚本, 但是用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就行

代码语言:javascript
复制
pip install text_unidecode

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

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 问题
  • 环境
  • 报错
  • 解决办法
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档