darkfeline
darkfeline

Reputation: 10642

Cython setup.py to install compiled extension

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?

Upvotes: 0

Views: 1686

Answers (1)

DaveP
DaveP

Reputation: 7102

According to the distutils documentation, you can build any compiled python modules in an arbitrary location using the command line option --build-base, e.g.:

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

Upvotes: 2

Related Questions