Python 3.6.5和cx_freeze:

时间:2018-04-19 22:20:35

标签: cx-freeze

我在尝试执行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}}?

1 个答案:

答案 0 :(得分:0)

idnadataidna包中的模块。使用cx_Freeze构建可执行文件时,请使用packages选项添加idna包。

在你的setup.py

setup(
    options={
        "build_exe": {
            "packages": ["idna"],
            },
        },
    )