关于 Windows 端 Python 3.7.2 embeddable 版运行报错

2018-12-25 19:17:03 +08:00
 chenstack

由于是版本控,从 Python 官网一开始说的 12 月 20 日盼到今天,Python 3.7.2 终于发布了,激动地下载安装包更新,顺便下了embeddable zip

因为自己的一个项目是 Python 嵌入 C++中(模仿 Sublime Text 的做法),覆盖新版的 pyd 及 Python37.zip 后却无法运行该项目了,这个 Python37.zip 是便携版打包后的标准库。

在 VS 中调试发现 Py_InitializeEx 失败了。把 python-3.7.2-embed-amd64.zip 解压后直接运行 python 也是无法运行,报错:Fatal Python error: initfsencoding: unable to load the file system codec zipimport.ZipImportError: can't find module 'encodings'。

我又下载了 3.7.1 版本的便携版 zip,用里面的 Python37.zip 覆盖 3.7.2 的却能运行。有人遇到这个问题吗,是否可以判断是 3.7.2 发行的 Python37.zip 有问题?目前想到的做法是自己把安装版的 Python 3.7.2 标准库编译成 pyc 打包一个 zip。

2956 次点击
所在节点    Python
2 条回复
justou
2018-12-26 00:30:57 +08:00
是的, 同样的错误, 而且不知道为啥压缩包里打包了两个一样的 vcruntime140.dll
chenstack
2019-01-09 19:38:43 +08:00
@justou Python 官方已经修复了这个问题,下载页面的链接也已经更新。
UPDATED 2019-01-09: An issue was discovered in the embeddable packages for Windows and updated download files have been provided for the Windows x86-64 embeddable zip file and the Windows x86 embeddable zip file and their GPG signatures. No other download was affected. See https://bugs.python.org/issue35596 for more information.

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/520937

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX