# now we are removing it del os.environ['PYTHONPATH'] # Add a minimal library (with spyderlib) at the end of sys.path to # be able to connect our monitor to the external console app_pythonpath = 'Spyder.app/Contents/Resources/lib/python2.7' full_pythonpath = [p for p in sys.path if p.endswith(app_pythonpath)] if full_pythonpath: sys.path.remove(full_pythonpath[0]) sys.path.append(full_pythonpath[0] + osp.sep + 'minimal-lib') else: # Add missing variables and methods to the app's site module import site import osx_app_site osx_app_site.setcopyright() osx_app_site.sethelper() site._Printer = osx_app_site._Printer site.USER_BASE = osx_app_site.getuserbase() site.USER_SITE = osx_app_site.getusersitepackages() mpl_backend = os.environ.get("MATPLOTLIB_BACKEND") if mpl_backend: try: import matplotlib if os.environ.get('QT_API') == 'pyside': # Try to address PySide lack of an input hook on Mac by settting # mpl_backend to always be MacOSX # Fixes Issue 347 if mpl_backend == 'Qt4Agg' and sys.platform == 'darwin': mpl_backend = 'MacOSX'
# be able to connect our monitor to the external console py_ver = '%s.%s' % (sys.version_info[0], sys.version_info[1]) app_pythonpath = '%s/Contents/Resources/lib/python%s' % ( MAC_APP_NAME, py_ver) full_pythonpath = [ p for p in sys.path if p.endswith(app_pythonpath) ] if full_pythonpath: sys.path.remove(full_pythonpath[0]) sys.path.append(full_pythonpath[0] + osp.sep + 'minimal-lib') else: # Add missing variables and methods to the app's site module import site import osx_app_site osx_app_site.setcopyright() osx_app_site.sethelper() site._Printer = osx_app_site._Printer site.USER_BASE = osx_app_site.getuserbase() site.USER_SITE = osx_app_site.getusersitepackages() #============================================================================== # Importing user's sitecustomize #============================================================================== try: import sitecustomize #analysis:ignore except ImportError: pass #============================================================================== # Add default filesystem encoding on Linux to avoid an error with # Matplotlib 1.5 in Python 2 (Fixes Issue 2793)