Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win7无法启动python的一些经验、报错展示 #59

Open
hiroi-sora opened this issue Oct 10, 2023 · 1 comment
Open

win7无法启动python的一些经验、报错展示 #59

hiroi-sora opened this issue Oct 10, 2023 · 1 comment

Comments

@hiroi-sora
Copy link

hiroi-sora commented Oct 10, 2023

例图:

弹窗

测试系统:win7 x64 旗舰 sp1 7601 纯净版
python版本:3.8.10 32位

如果运行PyStand,或者直接运行python解释器时,出现了这些错误:

无法启动此程序,因为计算机中丢失api-ms-win-crt-conio-l1-1-0.dll 。尝试重新安装该程序以解决此问题。

应用程序无法正常启动(0xc000007b)。请单击确定”关闭应用程序。

Cannot find Py_Main() in: ……/python3.dll

大概率是缺乏VC运行库导致。

下载安装VC运行库即可解决。
https://aka.ms/vs/17/release/vc_redist.x64.exe

@hiroi-sora
Copy link
Author

hiroi-sora commented Oct 10, 2023

win7下使用 qt-qml 时可能遇到的坑:

qml的UI由显卡渲染,但win7可能缺乏显卡支持,导致qml界面一跑起来就奔溃(exe已停止运行)。设为CPU软渲染即可解决:

from PySide2.QtGui import QGuiApplication
from PySide2.QtCore import Qt
QGuiApplication.setAttribute(Qt.AA_UseSoftwareOpenGL, True)

此时,必须保留PySide / PyQt中的文件 opengl32sw.dll ,不能删减。

但是在别的平台(如驱动完善的win7,或任意win10以上系统),可以删掉 opengl32sw.dll 以节省空间,不会影响软渲染的运行。

当然,如果你使用qt-Widgets而不是qt-qml,那么也许不依赖这个库。


另外,作者打包的精简库 PyStand-py38-pyside2-lite.7z ,删掉了所有vc、opengl相关的库。按我个人的经验,可能会在win7这样驱动支持较差的平台上出现问题。如果大家的项目有win7用户,建议自己手动裁剪pyside或pyqt库,多做测试~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant