python - 需要外部库时使用Maturin

标签 python rust pyo3 maturin

我正在尝试用我正在制作的Rust Crate制作一个Python包。问题是我需要RGSL crate,它需要在系统中安装libgsl0-dev
我正在尝试使用Maturin which uses Manylinux Docker镜像进行发布,以构建适用于Linux的所有内容。问题是该图像未安装libgsl0-dev,因此我添加了一行来制作了一个自定义图像:

FROM konstin2/maturin

# To solve problems with CentOS 6 EOL 
RUN echo "https://vault.centos.org/6.10/os/x86_64/" > /var/cache/yum/x86_64/6/base/mirrorlist.txt
RUN echo "http://vault.centos.org/6.10/extras/x86_64/" > /var/cache/yum/x86_64/6/extras/mirrorlist.txt
RUN echo "http://vault.centos.org/6.10/updates/x86_64/" > /var/cache/yum/x86_64/6/updates/mirrorlist.txt
RUN echo "http://vault.centos.org/6.10/sclo/x86_64/rh" > /var/cache/yum/x86_64/6/centos-sclo-rh/mirrorlist.txt
RUN echo "http://vault.centos.org/6.10/sclo/x86_64/sclo" > /var/cache/yum/x86_64/6/centos-sclo-sclo/mirrorlist.txt

# Installs needed library
RUN yum install -y libgsl0-dev

ENTRYPOINT ["/usr/bin/maturin"]
但是当我尝试构建时:docker run --rm -v $(pwd):/io custom-image build --cargo-extra-args="--no-default-features"

⚠ Warning: You're building a library without activating pyo3's extension-module feature. See https://pyo3.rs/v0.12.4/building_and_distribution.html#linking 🔗 Found pyo3 bindings 🐍 Found CPython 3.6m at python3.6, CPython 3.7m at python3.7, CPython 3.8 at python3.8, CPython 3.9 at python3.9
Compiling pyo3 v0.12.4 error: could not find native static library python3.6m, perhaps an -L flag is missing


我在这里想念的是什么?任何形式的帮助将非常感激

最佳答案

正如用户在this issue中指出的那样,已安装的GSL版本存在问题:我使用的是库的最新版本中添加的函数。另外,我必须使用命令wheel-repair来包含一些缺少的.so文件。整个过程在this issue

关于python - 需要外部库时使用Maturin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65186014/

相关文章:

python - 如何使用 PyO3 解码 PyCodeObject?

python - 在包含来自不同 crate 的类型的使用rust 结构上使用pyo3 pyclass

python - 如何将该字符串转换为 Unix 时间?

rust - 如果它的生命周期与其内容相同,为什么我不能两次使用对 Vec 的可变引用?

rust - 使用铁框架,如何退出监听循环?

rust - 如何在 Rust 2018 中惯用地为箱子起别名?

rust - 如何使用PyO3在Rust代码中嵌入的Python代码中执行地板分割?

python - 使用正则表达式避免在文本的开头和结尾出现字符

javascript - Send_keys 函数确实按 Selenium python 中的预期工作

python - 对 Pandas Dataframes 进行叉积