How do you write a setup.py to compile .pyx files in an arbitrary location and install the compiled code in another arbitrary location? For example dirA/spam.pyx
to build/dirB/spam.so
?
According to the distutils documentation , you can build any compiled python modules in an arbitrary location using the command line option --build-base
, eg:
python setup.py build --build-base=/build/dirB
If you want to keep the default build directory, but install to a custom location, you should use one of the options --user
--home
, --prefix
, --exec-prefix
, --install-base
or --install-platbase
Finally, if you just want the .so
file in the current directory, use the option --inplace
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.