没有名为“chardet”的模块

问题描述 投票:0回答:2

我使用 cx_Freeze 创建了一个 exe。
构建成功。
然后当我点击 exe 时,我得到:-

no module named 'queue'

所以,我研究并添加了这一行:-

from multiprocessing import Queue

现在我得到:-

no module named 'chardet'. 

这是我收到的完整错误:-

Traceback (most recent call last):
  File "C:\Users\pc\AppData\Local\Programs\Python\Python36-32\lib\site-pac
kages\cx_Freeze\initscripts\__startup__.py", line 14, in run
    module.run()
  File "C:\Users\pc\AppData\Local\Programs\Python\Python36-32\lib\site-pac
kages\cx_Freeze\initscripts\Console.py", line 26, in run
    exec(code, m.__dict__)
  File "normalapi_2103.py", line 1, in <module>
  File "C:\Users\pc\AppData\Local\Programs\Python\Python36-32\lib\site-pac
kages\requests-2.18.4-py3.6.egg\requests\__init__.py", line 44, in <module>
    import chardet
ModuleNotFoundError: No module named 'chardet'

我没有得到要导入的内容...

我也尝试过添加

setup.py 中的“requests”和“os”包。

但运气不佳...

python selenium cx-freeze
2个回答
0
投票

这应该只是将

chardet
添加到
includes
命令的问题。

build_exe_options = {"includes":["chardet"]}

请参阅

build_exe
选项。


0
投票

有同样的问题。另一个修复是将版本降级到

chardet==3.0.2
。 在我将后续记录和元数据文件下载到 chardet 文件夹中之前,我什至无法执行此操作:

https://rabbit.test.polarvagnen.se/env/lib/python3.6/site-packages/chardet-3.0.4.dist-info/

© www.soinside.com 2019 - 2024. All rights reserved.