cefpython3在用pyinstaller打包报错 ModuleNotFoundError: No module named 'json'

一枚码农404 2019-07-19 11:31:30
cefpython3在用pyinstaller打包的完成,运行的时候报错 ModuleNotFoundError: No module named 'json' 然后我在代码里import json, 然后打包在运行报错[0719/111409.715:ERROR:icu_util.cc(133)] Invalid file descriptor to ICU data received.
没有import json时候运行的报错信息:

在代码里使用import json时候运行的报错信息


这是打包信息



# -- coding=utf8 --
from cefpython3 import cefpython as cef
import platform
import sys
import json

def main():
check_versions()
sys.excepthook = cef.ExceptHook # To shutdown all CEF processes on error
cef.Initialize()
br = cef.CreateBrowserSync(url="file:///F:\\workspace\\eclipse-workspace\\Demo01\\html\\demo.html", window_title="Hello World!")
js = cef.JavascriptBindings()
js.SetFunction("py_func", py_func)
js.SetProperty("other", {"a": 1})
br.SetJavascriptBindings(js)
#cef.CreateBrowser(url="http://www.baidu.com", window_title="Hello World!")
cef.MessageLoop()
cef.Shutdown()

def py_func():
print("i am in python")

def check_versions():
ver = cef.GetVersion()
print("[hello_world.py] CEF Python {ver}".format(ver=ver["version"]))
print("[hello_world.py] Chromium {ver}".format(ver=ver["chrome_version"]))
print("[hello_world.py] CEF {ver}".format(ver=ver["cef_version"]))
print("[hello_world.py] Python {ver} {arch}".format(
ver=platform.python_version(),
arch=platform.architecture()[0]))
assert cef.__version__ >= "57.0", "CEF Python v57.0+ required to run this"

if __name__ == '__main__':
main()




...全文
2013 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
一枚码农404 2019-07-19
  • 打赏
  • 举报
回复
一样的,后面的参数我基本全是了,一样的效果
F:\workspace\eclipse-workspace\Demo01\test>pyinstaller -F test.py
680 INFO: PyInstaller: 3.5
680 INFO: Python: 3.7.3
681 INFO: Platform: Windows-7-6.1.7601-SP1
683 INFO: wrote F:\workspace\eclipse-workspace\Demo01\test\test.spec
686 INFO: UPX is not available.
690 INFO: Extending PYTHONPATH with paths
['F:\\workspace\\eclipse-workspace\\Demo01\\test',
'F:\\workspace\\eclipse-workspace\\Demo01\\test']
691 INFO: checking Analysis
691 INFO: Building Analysis because Analysis-00.toc is non existent
691 INFO: Initializing module dependency graph...
706 INFO: Initializing module graph hooks...
736 INFO: Analyzing base_library.zip ...
9335 INFO: running Analysis Analysis-00.toc
9390 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by d:\anaconda3\python.exe
10233 INFO: Caching module hooks...
10238 INFO: Analyzing F:\workspace\eclipse-workspace\Demo01\test\test.py
10641 INFO: Loading module hooks...
10642 INFO: Loading module hook "hook-encodings.py"...
10809 INFO: Loading module hook "hook-pydoc.py"...
10810 INFO: Loading module hook "hook-xml.py"...
11333 INFO: Looking for ctypes DLLs
11348 INFO: Analyzing run-time hooks ...
11356 INFO: Looking for dynamic libraries
12000 WARNING: lib not found: python36.dll dependency of C:\Users\Administrator\AppData\Roaming\Python\Python37\site-packages\cefpython3\cefpython_py36.pyd
12176 WARNING: lib not found: python35.dll dependency of C:\Users\Administrator\AppData\Roaming\Python\Python37\site-packages\cefpython3\cefpython_py35.pyd
12288 WARNING: lib not found: python34.dll dependency of C:\Users\Administrator\AppData\Roaming\Python\Python37\site-packages\cefpython3\cefpython_py34.pyd
12375 WARNING: lib not found: python27.dll dependency of C:\Users\Administrator\AppData\Roaming\Python\Python37\site-packages\cefpython3\cefpython_py27.pyd
12545 WARNING: lib not found: MSVCR90.dll dependency of C:\Users\Administrator\AppData\Roaming\Python\Python37\site-packages\cefpython3\cefpython_py27.pyd
13648 WARNING: lib not found: MSVCR90.dll dependency of C:\Users\Administrator\AppData\Roaming\Python\Python37\site-packages\cefpython3\MSVCP90.dll
13683 INFO: Looking for eggs
13684 INFO: Using Python library d:\anaconda3\python37.dll
13684 INFO: Found binding redirects:
[]
13689 INFO: Warnings written to F:\workspace\eclipse-workspace\Demo01\test\build\test\warn-test.txt
13740 INFO: Graph cross-reference written to F:\workspace\eclipse-workspace\Demo01\test\build\test\xref-test.html
13815 INFO: checking PYZ
13816 INFO: Building PYZ because PYZ-00.toc is non existent
13816 INFO: Building PYZ (ZlibArchive) F:\workspace\eclipse-workspace\Demo01\test\build\test\PYZ-00.pyz
14612 INFO: Building PYZ (ZlibArchive) F:\workspace\eclipse-workspace\Demo01\test\build\test\PYZ-00.pyz completed successfully.
14633 INFO: checking PKG
14633 INFO: Building PKG because PKG-00.toc is non existent
14634 INFO: Building PKG (CArchive) PKG-00.pkg
36459 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
36463 INFO: Bootloader d:\anaconda3\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
36464 INFO: checking EXE
36464 INFO: Building EXE because EXE-00.toc is non existent
36464 INFO: Building EXE from EXE-00.toc
36483 INFO: Appending archive to EXE F:\workspace\eclipse-workspace\Demo01\test\dist\test.exe
36606 INFO: Building EXE from EXE-00.toc completed successfully.

F:\workspace\eclipse-workspace\Demo01\test>cd dist

F:\workspace\eclipse-workspace\Demo01\test\dist>dir
驱动器 F 中的卷是 存档
卷的序列号是 000F-59D0

F:\workspace\eclipse-workspace\Demo01\test\dist 的目录

2019/07/19 周五 15:47 <DIR> .
2019/07/19 周五 15:47 <DIR> ..
2019/07/19 周五 15:47 53,990,452 test.exe
1 个文件 53,990,452 字节
2 个目录 131,508,326,400 可用字节

F:\workspace\eclipse-workspace\Demo01\test\dist>test.exe
[hello_world.py] CEF Python 66.0
[hello_world.py] Chromium 66.0.3359.181
[hello_world.py] CEF 3.3359.1774.gd49d25f
[hello_world.py] Python 3.7.3 64bit
[0719/154732.897:ERROR:icu_util.cc(133)] Invalid file descriptor to ICU data received.
小羽Jary 2019-07-19
  • 打赏
  • 举报
回复
用pyinstaller -F test.py打包,带上-F参数

37,744

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • WuKongSecurity@BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧