[英]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? 你如何编写一个setup.py来编译任意位置的.pyx文件,并将编译后的代码安装在另一个任意位置? For example
dirA/spam.pyx
to build/dirB/spam.so
? 例如
dirA/spam.pyx
来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: 根据distutils文档 ,您可以使用命令行选项
--build-base
在任意位置构建任何已编译的python模块,例如:
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
如果你想保持默认的build目录,但安装到自定义位置,你应该使用的选项之一
--user
--home
, --prefix
, --exec-prefix
, --install-base
或--install-platbase
Finally, if you just want the .so
file in the current directory, use the option --inplace
最后,如果您只想在当前目录中使用
.so
文件,请使用选项--inplace
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.