Fix 3.9 Big Sur bug
* Fix 3.9 Big Sur bug
This fix seems to work whether pythonw is installed or not as the environment variable is set before call in both cases
* added Catalina and Big Sur flags
As suggested by
@@ -224,13 +224,21 @@ def main():
# See https://github.com/napari/napari/pull/1554 and
# https://github.com/napari/napari/issues/380#issuecomment-659656775
# and https://github.com/ContinuumIO/anaconda-issues/issues/199
- _MACOS_LATEST = sys.platform == "darwin" and StrictVersion(
+ _MACOS_AT_LEAST_CATALINA = sys.platform == "darwin" and StrictVersion(
platform.release()
) > StrictVersion('19.0.0')
+ _MACOS_AT_LEAST_BIG_SUR = sys.platform == "darwin" and StrictVersion(
+ platform.release()
+ ) > StrictVersion('20.0.0')
+
_RUNNING_CONDA = "CONDA_PREFIX" in os.environ
_RUNNING_PYTHONW = "PYTHONEXECUTABLE" in os.environ
- if _MACOS_LATEST and _RUNNING_CONDA and not _RUNNING_PYTHONW:
+ # quick fix for Big Sur py3.9
+ if _MACOS_AT_LEAST_BIG_SUR:
+ os.environ['QT_MAC_WANTS_LAYER'] = '1'
+
+ if _MACOS_AT_LEAST_CATALINA and _RUNNING_CONDA and not _RUNNING_PYTHONW:
python_path = Path(sys.exec_prefix) / 'bin' / 'pythonw'
if python_path.exists():
