|
From: Jeremy K. <jer...@gm...> - 2016-03-09 04:38:44
|
Ok. Here is a little script to see what imports are required for a
given module:
# -- begin --
import sys
initial = set(sys.modules)
# change this import as needed for testing
import numpy.core.multiarray
# determine which modules have been added by the import statement
loaded = set(sys.modules) - initial
# remove "placeholder" modules
loaded -= set(name for name in loaded if sys.modules[name] is None)
# remove built-in modules
loaded -= set(name for name in loaded if not
hasattr(sys.modules[name], '__file__'))
# finally, find the extension modules
for name in loaded:
fn = sys.modules[name].__file__
if fn.lower().endswith('.pyd'):
print(fn)
# -- end --
Copy/Paste the above into a new .py file and run it with python:
python somefile.py
The output will be the names of extension modules which are needed by
the given import. A quick test locally produces:
C:\Python27\lib\site-packages\numpy\random\mtrand.pyd
C:\Python27\lib\site-packages\numpy\core\umath.pyd
C:\Python27\lib\site-packages\numpy\fft\fftpack_lite.pyd
C:\Python27\lib\site-packages\numpy\core\multiarray.pyd
C:\Python27\lib\site-packages\numpy\linalg\_umath_linalg.pyd
C:\Python27\lib\site-packages\numpy\linalg\lapack_lite.pyd
The listed files should exist in the DIST directory of py2exe executable.
--
Jeremy Kloth
|