python - Python bdist_wheel + install 有效,但由于 PEP 517 sdist + install 失败
问题描述
我正在开发一个 Python 包,它使用 Pybind11 + cmake 包装了一个 C++ 库,代码可在https://github.com/bayesmix-dev/pybmix获得
由于我在 Linux 上工作,为了通过 PyPi 分发它,我知道有两种选择:
- 构建一个 manylinux 轮子
- 分发二进制文件,用户需要在本地安装
鉴于我不确定有多少用户会使用我的包,我选择了第二个选项。此外,我通过 CMake 子模块处理所有 C++ 库,以便该库是“自包含的”。
现在问题来了:运行
python3 setup.py bdist_wheel
产生一个dist/pybmix-0.0.2-cp38-cp38-linux_x86_64.whl
由于linux_...
零件而损坏的文件。然而运行
pip3 install pybmix-0.0.2-cp38-cp38-linux_x86_64.whl
在我的机器上工作
跑步
python3 setup.py sdist
产生一个文件dist/pybmix-0.0.2.tar.gz
,安装它失败:
pip3 install dist/pybmix-0.0.2.tar.gz
.....
subprocess.CalledProcessError: Command '['cmake', '--version']' returned non-zero exit status 1.
----------------------------------------
ERROR: Failed building wheel for pybmix
Failed to build pybmix
ERROR: Could not build wheels for pybmix which use PEP 517 and cannot be installed directly
也可能相关但可能不相关,我正在使用协议缓冲区生成一些 Python 和 C++ 文件,这是在 CMakeLists.txt 文件中完成的,因此在我的 setup.py 中,我已经覆盖了build_py
第一次调用build_ext
(被覆盖为以及在https://github.com/pybind/cmake_example中)
解决方案
推荐阅读
- python - 在数组元素之间插入 N 个零
- python - 使用 os.walk 排除根目录
- netsuite - 使用套件脚本 2 添加复选框
- angular - 出现错误错误:无法使用测试平台解析所有参数
- android - 如何重命名 Firebase 存储中的文件?
- python - Pandas 数据框取消堆叠数据并创建新列
- wordpress - 创建一个 Wordpress 管理菜单项并链接到一个页面
- python - /login/ 处的 AttributeError:无法通过用户实例访问管理器
- selenium - 在 Microsoft HTML 组件中找不到元素
- javascript - 如何在 Angular 中一段时间后在 mat-input 上设置错误?