【问题标题】:private Python packages built by wheel got Error .whl is not a supported wheel on this platform由 wheel 构建的私有 Python 包出现错误 .whl is not a supported wheel on this platform
【发布时间】:2021-07-12 04:28:01
【问题描述】:

我写了一个C嵌入式python包,用下面的代码构建了一个wheel文件:

  python3 setup.py bdist_wheel

在我的 dist 文件夹中,我发现: mypackage-1.0-cp38-cp38-macosx_10_14_6_x86_64.whl

操作系统版本:10.15.7

64位-Python版本:3.8

pip3 版本:21.1.3

我的第一个问题是我的macosx的版本是10.15.7,但是为什么轮子将.whl文件构建为10.14.6版本

然后我尝试使用以下方式安装软件包:

python3 -m pip  install dist/*

我收到错误为 ERROR: mypackage-1.0-cp38-cp38-macosx_10_14_6_x86_64.whl is not a supported wheel on this platform.

然后我将 .whl 文件更改为“mypackage-1.0-cp38-cp38-macosx_10_15_7_x86_64.whl”并得到同样的错误。

谁有什么问题? 下面是我的 setup.py

#!/usr/bin/env python
from setuptools import setup, Extension
import numpy as np

c_mycode = Extension(
    'c_mycode',
    sources=['c_mycode/pymycode.c',
             'c_mycode/mycode.c' ],
    include_dirs=['c_mycode', np.get_include()],
    define_macros=[('NPY_NO_DEPRECATED_API', 'NPY_1_4_API_VERSION')])

setup(
    name='mypackage',
    version='1.0',
    description=(
      "a package in Python."
    ),
    setup_requires=["wheel"],
    author='xxx',
    author_email='xxx@xxx',
    license="BSD compatable (see the LICENSE file)",
    packages=['mycode'],
    ext_modules=[c_mycode]
)

【问题讨论】:

    标签: python python-wheel


    【解决方案1】:

    可能有更好的方法,但我通过借鉴的想法解决了这个问题

    here

    我添加了一行来指定使用的平台版本

    options={'bdist_wheel':{'plat_name':'macosx_10_15_x86_64'}}
    

    【讨论】:

      猜你喜欢
      • 2022-11-03
      • 1970-01-01
      • 2018-06-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-29
      • 1970-01-01
      • 2023-01-18
      相关资源
      最近更新 更多