whl is not a supported wheel on this platform

使用cypthon编译的程序带有“cp37-cp37m-linux_x86_64.whl”

实际安装的时候显示whl is not a supported wheel on this platform。

一时间不知道该怎么处理。

查看系统支持的安装版本

1、首先获取系统版本信息

import platform
print(platform.platform())

输出信息Linux-xxxxxxx-x86_64-with-glibc2.29.

2、判断pip能安装的数据类型

import wheel.pep425tags as w
print(w.get_supported("linux_x86_64"))

输出('cp38','cp38','linux_x86_64')。

3、就是改名字

“cp37-cp37m-linux_x86_64.whl”---》“cp38-cp38-linux_x86_64.whl”

4、待验证了。

实际运行的时候还是会有找不到文件的提示,因此so文件不要添加扩展名

import os
import sysconfig

from distutils.core import setup
from Cython.Build import cythonize
from Cython.Distutils import build_ext


def get_ext_filename_without_platform_suffix(filename):
    name, ext = os.path.splitext(filename)
    ext_suffix = sysconfig.get_config_var('EXT_SUFFIX')

    if ext_suffix == ext:
        return filename

    ext_suffix = ext_suffix.replace(ext, '')
    idx = name.find(ext_suffix)

    if idx == -1:
        return filename
    else:
        return name[:idx] + ext


class BuildExtWithoutPlatformSuffix(build_ext):
    def get_ext_filename(self, ext_name):
        filename = super().get_ext_filename(ext_name)
        return get_ext_filename_without_platform_suffix(filename)


setup(
    name="foo",
    cmdclass={'build_ext': BuildExtWithoutPlatformSuffix},
    ext_modules=cythonize("foo.pyx")
)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值