Install a Python extension in a specific location

My project combines pure Python code and Cython extensions to optimize and link to C libraries. I have one source tree for my Python project and one for Cython and C code. Each Cython extension has a setup.py file to create them. In fact, for each extension, I do the following:

python setup.py build_ext --inplace mv myext.so ../some/specific/place/ 

Is there a way to tell distutils where to install my extension (if possible using a relative path) instead of using --inplace followed by mv ? Using the --prefix option is not very good, because it creates a hierarchy of folders that I don't need.

+6
source share
2 answers

I finally found the answer! The -b option (or --build_lib)

 python setup.py build_ext -b ../some/specific/place/ 
+9
source

Perhaps you could use an alternative installation of functionnality distutils, which allows you to delete useless hierarchy folders.

Try something like this:

 python setup.py install --home=../some/specific/place \ --install-purelib=. \ --install-platlib=. 
0
source

Source: https://habr.com/ru/post/890629/


All Articles