Skip to content

Instantly share code, notes, and snippets.

@ColdGrub1384
Created June 17, 2020 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ColdGrub1384/ed31b637061eac40970614a752c260e7 to your computer and use it in GitHub Desktop.
Save ColdGrub1384/ed31b637061eac40970614a752c260e7 to your computer and use it in GitHub Desktop.
Fixes C extensions when ODR fail to load and scripts are in site-packages
from extensionsimporter import DownloadableImporter, update_mods, c
from pyto import __Class__
import sys
import threading
try:
__Class__("PyCore").startupScript = threading.current_thread().script_path
except AttributeError:
pass # Running from startup
for path in sys.meta_path:
if isinstance(path, DownloadableImporter):
sys.meta_path.remove(path)
break
initializers = [
c.init_matplotlib,
c.init_pandas,
c.init_biopython,
c.init_lxml,
c.init_scipy,
c.init_sklearn,
c.init_skimage,
c.init_pil,
c.init_numpy,
c.init_cffi,
c.init_bcrypt,
c.init_pywt,
c.init_statsmodels,
c.init_zmq,
c.init_gensim,
c.init_regex,
c.init_astropy,
c.init_emd,
c.init_cv2,
c.init_nacl,
]
for init in initializers:
init()
update_mods()
print("Done")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment