I'm developing a small tool which uses mainly NumPy and one SciPy module (scipy.optimize.fsolve). My idea of sharing it with others is that it comes in package with Portable Python so that theoretically everyone can run it.
The whole SciPy package weighs a lot (about 80 mb). Is it possible to compile only 1 module into *.pyd and import it as any other module, so that I don't have to include modules that I don't actually need?
There are several possibilities if you want to distribute only a subset SciPy code with your code (and in particular scipy.optimize.fsolve
),
fsolve
function. After a quick glance that would be at least, scipy/optimize/optimize.py
, scipy/optimize/minpack.py
, scipy/optimize/_minpack.so/.pyd
(but maybe I missed a couple). scipy/weave
, scipy/sparse
, scipy/linalg
etc. scipy.optimize.fsolve
and compile it to C code with cython, this should produce an independent .pyd/.so There should be a python module to do this automatically, for instance pyinstaller
does include only the required modules in the binary executable it produces. So you would need an equivalent of pyinstaller
that produces dynamic libraries.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.