“错误:没有提供命令".使用distutils.core时 [英] "error: no commands supplied" when using distutils.core

查看:62
本文介绍了“错误:没有提供命令".使用distutils.core时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在CentOS 7上使用Python3.我正在尝试构建

I am using Python 3 on CentOS 7. I am trying to build a C extension as described here. I have written a simple program, demo.c, which is in a directory in PYTHONPATH. demo.c has the following form.

#include <stdio.h>
#include <stdlib.h>

int main()
{
    printf("Hello from demo.c\n");
    return 0;
}

此代码运行无误.

from distutils.core import setup, Extension

module1 = Extension('demo',
                sources = ['demo.c'])

但是,以下代码

setup (name = 'PackageName',
   version = '1.0',
   description = 'This is a demo package',
   ext_modules = [module1])

产生以下错误.

An exception has occurred, use %tb to see the full traceback.

SystemExit: usage: CInterface.py [global_opts] cmd1 [cmd1_opts] [cmd2     [cmd2_opts] ...]
or: CInterface.py --help [cmd1 cmd2 ...]
or: CInterface.py --help-commands
or: CInterface.py cmd --help

error: no commands supplied

推荐答案

该错误表示您需要传递Distutils命令,例如 build

The error is saying you'll need to pass in a Distutils command, such as build (or probably build_ext in your case).

python CInterface.py build_ext

这篇关于“错误:没有提供命令".使用distutils.core时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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