【发布时间】:2021-01-12 07:07:55
【问题描述】:
有没有办法在 Python 脚本中以编程方式为使用 OpenGL(尤其是使用 Qt 的应用程序)的基于 Python 的应用程序设置 NvOptimusEnablement 标志?
到目前为止我看到的所有参考资料 - 例如Programmatically selecting integrated graphics in nVidia Optimus 或 https://stackoverflow.com/a/39047129/6531515 - 用于 C/C++,需要将标志设置为编译到可执行文件中的全局定义,但显然在这种情况下不起作用。
是唯一的选择:
- 使用此标志集创建自定义 Python 解释器包装器(例如 https://github.com/cprogrammer1994/optimuspy),或者
- 强制用户将 Python / pyinstaller-created-binary 明确标记为他们使用的每台机器都需要 Nvidia GPU?
【问题讨论】:
标签: python opengl pyqt5 nvidia optimus