如何创建一个纯 Python 轮子 [英] How to create a Pure-Python wheel

查看:46
本文介绍了如何创建一个纯 Python 轮子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从下面的 setup.py 文件,我试图从一个应该只包含 python 2.7 代码的项目中创建一个纯 python 轮.

From the following setup.py file, I am trying to create a pure-python wheel from a project that should contain only python 2.7 code.

from setuptools import setup

setup(
    name='foo',
    version='0.0.1',
    description='',
    url='',
    install_requires=[
        'bpython',
        'Django==1.8.2',
    ],
)

但是,当我运行 python setup.py bdist_wheel 生成的轮文件是特定于平台的 foo-0.0.1-cp27-none-macosx_10_9_x86_64.whl wheel文件而不是预期的 foo-0.0.1-cp27-none-any.whl.当我尝试在不同的平台上安装这个轮子时,它失败说它与这个 Python 不兼容.

However, when I run python setup.py bdist_wheel the wheel file that is generated is platform specific foo-0.0.1-cp27-none-macosx_10_9_x86_64.whl wheel file instead of the expected foo-0.0.1-cp27-none-any.whl. When I try to install this wheel on a different platform it fails saying it is not compatible with this Python.

我需要更改 setup.py 文件或 python 解释器的某些内容,也许可以让这个轮子在任何平台上使用?

I there something I need to change about the setup.py file or python interpreter, perhaps, that will allow this wheel to be used on any platform?

推荐答案

将分类器字段添加到我的 setup.py 解决了这个问题.

Adding the classifiers field to my setup.py fixed this issue.

from setuptools import setup

setup(
    name='foo',
    version='0.0.1',
    description='',
    url='',
    classifiers=[
        'Programming Language :: Python :: 2.7',
    ],
    install_requires=[
        'bpython',
        'Django==1.8.2',
    ],
)

这篇关于如何创建一个纯 Python 轮子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆