Is there a way to programmically set the NvOptimusEnablement flag for a Python-based application using OpenGL (and in particular, those using Qt) from within the Python script?
All the references I've seen so far - e.g. Programmatically selecting integrated graphics in nVidia Optimus, or https://stackoverflow.com/a/39047129/6531515 - are for C/C++, where the flag needs to be set as a global define which is compiled into the executable, but obviously that won't work in this case.
Are the only options to:
- Create a custom Python interpreter wrapper with this flag set (e.g. https://github.com/cprogrammer1994/optimuspy), OR
- Force users to explicitly tag Python / pyinstaller-created-binary as requiring the Nvidia GPU per machine they use?