我在尝试执行python可执行程序时收到此消息,使用.py
构建,但是当我执行python脚本D:\TEST2000>Get-List-FoldersID-and-Titles.exe Traceback (most recent call last): File "C:\Python-365\lib\site-packages\cx_Freeze\initscripts__startup__.py", line 14, in run module.run() File "C:\Python-365\lib\site-packages\cx_Freeze\initscripts\Console.py", line 26, in run exec(code, m.dict) File "D:\TEST2000\Get-List-FoldersID-and-Titles.py", line 5, in import requests File "C:\Python-365\lib\site-packages\requests__init__.py", line 98, in from . import packages File "C:\Python-365\lib\site-packages\requests\packages.py", line 7, in locals()[package] = import(package) File "C:\Python-365\lib\site-packages\idna__init__.py", line 2, in from .core import * File "C:\Python-365\lib\site-packages\idna\core.py", line 1, in from . import idnadata ImportError: cannot import name 'idnadata'
时,没有问题
ImportError
如何解决我得到的{{1}}?
答案 0 :(得分:0)
idnadata
是idna
包中的模块。使用cx_Freeze构建可执行文件时,请使用packages
选项添加idna
包。
在你的setup.py
中setup(
options={
"build_exe": {
"packages": ["idna"],
},
},
)