Install Python extension to specific location
My project mix pure Python code, and Cython extensions for optimization and for linking with C libraries. I have one source tree for my Python project, and one for Cython and C code. My Cython extensions each have a setup.py file to build them. Actually, for each extension, I do the following:
python setup.py build_ext --inplace
mv myext.so ../some/specific/place/
Is there a way to specify to distutils where to install my extension (if possible, using a relative path), instead of using --inplace
followed by开发者_开发百科 mv
? Using --prefix
option isn't good, since it creates a hierarchy of folders I don't need.
I finally found the answer! The option is -b (or --build_lib)
python setup.py build_ext -b ../some/specific/place/
Maybe you could use the alternate installation functionnality of distutils which will allow you to remove the useless hierarchy folders.
Try something like this :
python setup.py install --home=../some/specific/place \
--install-purelib=. \
--install-platlib=.
精彩评论