- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正尝试按照 Cython 中的教程进行操作:http://docs.cython.org/docs/tutorial.html#the-basics-of-cython我遇到了问题。
文件非常简单。我有一个 helloworld.pyx:
print "Hello World"
和一个setup.py:
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
setup(
cmdclass = {'build_ext': build_ext},
ext_modules = [Extension("helloworld", ["helloworld.pyx"])]
)
然后我用标准命令编译它:
python setup.py build_ext --inplace
我收到以下错误:
running build
running build_ext
building 'helloworld' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c helloworld.c -o build/temp.linux-x86_64-2.6/helloworld.o
helloworld.c:4:20: error: Python.h: No such file or directory
helloworld.c:5:26: error: structmember.h: No such file or directory
helloworld.c:34: error: expected specifier-qualifier-list before ‘PyObject’
helloworld.c:121: error: expected specifier-qualifier-list before ‘PyObject’
helloworld.c:139: error: expected ‘)’ before ‘*’ token
helloworld.c:140: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__pyx_PyInt_AsLongLong’
helloworld.c:141: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__pyx_PyInt_AsUnsignedLongLong’
helloworld.c:142: error: expected ‘)’ before ‘*’ token
helloworld.c:147: error: expected ‘)’ before ‘*’ token
helloworld.c:148: error: expected ‘)’ before ‘*’ token
helloworld.c:149: error: expected ‘)’ before ‘*’ token
helloworld.c:150: error: expected ‘)’ before ‘*’ token
helloworld.c:151: error: expected ‘)’ before ‘*’ token
helloworld.c:152: error: expected ‘)’ before ‘*’ token
helloworld.c:153: error: expected ‘)’ before ‘*’ token
helloworld.c:154: error: expected ‘)’ before ‘*’ token
helloworld.c:155: error: expected ‘)’ before ‘*’ token
helloworld.c:156: error: expected ‘)’ before ‘*’ token
helloworld.c:157: error: expected ‘)’ before ‘*’ token
helloworld.c:172: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
helloworld.c:173: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
helloworld.c:174: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
helloworld.c:181: error: expected ‘)’ before ‘*’ token
helloworld.c:198: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
helloworld.c:200: error: array type has incomplete element type
helloworld.c:221: error: ‘__pyx_kp_1’ undeclared here (not in a function)
helloworld.c:221: warning: excess elements in struct initializer
helloworld.c:221: warning: (near initialization for ‘__pyx_string_tab[0]’)
helloworld.c:221: warning: excess elements in struct initializer
helloworld.c:221: warning: (near initialization for ‘__pyx_string_tab[0]’)
helloworld.c:221: warning: excess elements in struct initializer
helloworld.c:221: warning: (near initialization for ‘__pyx_string_tab[0]’)
helloworld.c:221: warning: excess elements in struct initializer
helloworld.c:221: warning: (near initialization for ‘__pyx_string_tab[0]’)
helloworld.c:221: warning: excess elements in struct initializer
helloworld.c:221: warning: (near initialization for ‘__pyx_string_tab[0]’)
helloworld.c:221: warning: excess elements in struct initializer
helloworld.c:221: warning: (near initialization for ‘__pyx_string_tab[0]’)
helloworld.c:222: warning: excess elements in struct initializer
helloworld.c:222: warning: (near initialization for ‘__pyx_string_tab[1]’)
helloworld.c:222: warning: excess elements in struct initializer
helloworld.c:222: warning: (near initialization for ‘__pyx_string_tab[1]’)
helloworld.c:222: warning: excess elements in struct initializer
helloworld.c:222: warning: (near initialization for ‘__pyx_string_tab[1]’)
helloworld.c:222: warning: excess elements in struct initializer
helloworld.c:222: warning: (near initialization for ‘__pyx_string_tab[1]’)
helloworld.c:222: warning: excess elements in struct initializer
helloworld.c:222: warning: (near initialization for ‘__pyx_string_tab[1]’)
helloworld.c:222: warning: excess elements in struct initializer
helloworld.c:222: warning: (near initialization for ‘__pyx_string_tab[1]’)
helloworld.c:237: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘inithelloworld’
helloworld.c:238: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘inithelloworld’
helloworld.c:305: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
helloworld.c:313: error: expected ‘)’ before ‘*’ token
helloworld.c:379:21: error: compile.h: No such file or directory
helloworld.c:380:25: error: frameobject.h: No such file or directory
helloworld.c:381:23: error: traceback.h: No such file or directory
helloworld.c: In function ‘__Pyx_AddTraceback’:
helloworld.c:384: error: ‘PyObject’ undeclared (first use in this function)
helloworld.c:384: error: (Each undeclared identifier is reported only once
helloworld.c:384: error: for each function it appears in.)
helloworld.c:384: error: ‘py_srcfile’ undeclared (first use in this function)
helloworld.c:385: error: ‘py_funcname’ undeclared (first use in this function)
helloworld.c:386: error: ‘py_globals’ undeclared (first use in this function)
helloworld.c:387: error: ‘empty_string’ undeclared (first use in this function)
helloworld.c:388: error: ‘PyCodeObject’ undeclared (first use in this function)
helloworld.c:388: error: ‘py_code’ undeclared (first use in this function)
helloworld.c:389: error: ‘PyFrameObject’ undeclared (first use in this function)
helloworld.c:389: error: ‘py_frame’ undeclared (first use in this function)
helloworld.c:392: warning: implicit declaration of function ‘PyString_FromString’
helloworld.c:399: warning: implicit declaration of function ‘PyString_FromFormat’
helloworld.c:412: warning: implicit declaration of function ‘PyModule_GetDict’
helloworld.c:412: error: ‘__pyx_m’ undeclared (first use in this function)
helloworld.c:415: warning: implicit declaration of function ‘PyString_FromStringAndSize’
helloworld.c:420: warning: implicit declaration of function ‘PyCode_New’
helloworld.c:429: error: ‘__pyx_empty_tuple’ undeclared (first use in this function)
helloworld.c:440: warning: implicit declaration of function ‘PyFrame_New’
helloworld.c:441: warning: implicit declaration of function ‘PyThreadState_GET’
helloworld.c:448: warning: implicit declaration of function ‘PyTraceBack_Here’
helloworld.c:450: warning: implicit declaration of function ‘Py_XDECREF’
helloworld.c: In function ‘__Pyx_InitStrings’:
helloworld.c:458: error: ‘__Pyx_StringTabEntry’ has no member named ‘p’
helloworld.c:460: error: ‘__Pyx_StringTabEntry’ has no member named ‘is_unicode’
helloworld.c:460: error: ‘__Pyx_StringTabEntry’ has no member named ‘is_identifier’
helloworld.c:461: error: ‘__Pyx_StringTabEntry’ has no member named ‘p’
helloworld.c:461: warning: implicit declaration of function ‘PyUnicode_DecodeUTF8’
helloworld.c:461: error: ‘__Pyx_StringTabEntry’ has no member named ‘s’
helloworld.c:461: error: ‘__Pyx_StringTabEntry’ has no member named ‘n’
helloworld.c:461: error: ‘NULL’ undeclared (first use in this function)
helloworld.c:462: error: ‘__Pyx_StringTabEntry’ has no member named ‘intern’
helloworld.c:463: error: ‘__Pyx_StringTabEntry’ has no member named ‘p’
helloworld.c:463: warning: implicit declaration of function ‘PyString_InternFromString’
helloworld.c:463: error: ‘__Pyx_StringTabEntry’ has no member named ‘s’
helloworld.c:465: error: ‘__Pyx_StringTabEntry’ has no member named ‘p’
helloworld.c:465: error: ‘__Pyx_StringTabEntry’ has no member named ‘s’
helloworld.c:465: error: ‘__Pyx_StringTabEntry’ has no member named ‘n’
helloworld.c:476: error: ‘__Pyx_StringTabEntry’ has no member named ‘p’
helloworld.c: At top level:
helloworld.c:485: error: expected ‘)’ before ‘*’ token
helloworld.c:494: error: expected ‘)’ before ‘*’ token
helloworld.c:500: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__pyx_PyInt_AsLongLong’
helloworld.c:516: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__pyx_PyInt_AsUnsignedLongLong’
helloworld.c:538: error: expected ‘)’ before ‘*’ token
helloworld.c:553: error: expected ‘)’ before ‘*’ token
helloworld.c:568: error: expected ‘)’ before ‘*’ token
helloworld.c:583: error: expected ‘)’ before ‘*’ token
helloworld.c:598: error: expected ‘)’ before ‘*’ token
helloworld.c:613: error: expected ‘)’ before ‘*’ token
helloworld.c:628: error: expected ‘)’ before ‘*’ token
helloworld.c:643: error: expected ‘)’ before ‘*’ token
helloworld.c:658: error: expected ‘)’ before ‘*’ token
helloworld.c:673: error: expected ‘)’ before ‘*’ token
helloworld.c:688: error: expected ‘)’ before ‘*’ token
error: command 'gcc' failed with exit status 1
我从 Ubuntu 9.04 存储库安装了 python 和 cython。我不明白为什么编译器找不到 Python.h。
我试过:
cython helloworld.pyx
然后用gcc手动编译结果:
gcc -shared -pthread -fPIC -fwrapv -O2 -Wall -fno-strict-aliasing -I/usr/include/python2.5 -o helloworld.so helloworld.c
并得到完全相同的错误消息。
有什么线索吗?
最佳答案
看起来您缺少一些像 python_dev
之类的软件包——Debian 和衍生产品(包括 Ubuntu)长期以来倾向于将可能被“开发人员”使用的所有东西与包裹中“每个人”的部分……我可以辩论的一种哲学立场(并且已经在许多论坛中辩论过,但没有取得太大的实际成功),但可悲的是,不能只是忽略:-(
关于c++ - 来自 cython wiki 的 Hello World 无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1191600/
我的 CS2 讲师给出了一个 java 正则表达式,用于检查单词是否重复: \\b(\\w+)\\s+\\1\\b 如何修改它来检查某个单词是否重复两次,如“hello hello hello”或“h
关闭。这个问题是not reproducible or was caused by typos .它目前不接受答案。 这个问题是由于错别字或无法再重现的问题引起的。虽然类似的问题可能是on-topi
这个问题已经有答案了: printf anomaly after "fork()" (3 个回答) 已关闭 3 年前。 #include #include Void main() { Printf
我一直在分配以下作业来解释 3 个语句中发生的事情,但我无法弄清楚。 cout << ("hello" + 1); // ello cout << (*"hello") + 1; // 10
如何确定用户是否使用 hello.js 登录? 使用 Google Sign-In SDK,我可以使用 gapi.auth2.init() 注册回调,当设置 SDK 并准备好回答诸如“你是登录了吗?”
执行String S1 = "hello";后,JVM将在SCP中创建一个String对象,该对象将在value字段中保存一个字符数组,如 s1.value = {'h', 'e', 'l', 'l'
我正在 build gomobile Hello示例应用程序,但遇到以下问题:在 Xcode (7.1) 中打开应用程序后尝试构建并运行该应用程序时,出现错误“找不到 hello/Hello.h”文件
#coding=utf-8 '''Tkinter module''' from Tkinter import * import time root=Tk() t=Text(root,fg='red')
在C/C++中,下面两行代码有什么区别: char *str1="hello"; char *str2={"hello"}; 最佳答案 根据 2011 C 标准,条款 6.7.9 初始化,第 11
我对在 android studio 中导入 import.hello.Hello 时出错有疑问,如下图所示。请给我解决方案如何解决这个错误 最佳答案 请参阅此处 @Arpit Patel answe
hello/ 忽略文件夹结构中任何位置名为“hello”的所有文件夹 hello/* 仅忽略顶级文件夹“hello”。 这是为什么?请指出http://git-scm.com/docs/gitigno
请解释以下程序中发生了什么。 我在程序的开头和结尾检查了 strerror(errno) 返回的地址,并确认它每次都返回相同的地址。然后一旦确定这一点,在第一种情况下我继续将相同的地址分配给 ptr,
在整个互联网上你都会看到这个命令 alias hello='echo Hello' 是的,我知道以上是一个蹩脚的例子,但它不是重点。如果我执行它,它就会起作用。但是当我重新启动计算机时,它丢失了。为什
我正在学习 C++ 指针,而 -> 运算符对我来说似乎很奇怪。代替ptr->hello(); 可以写成 (*ptr).hello(); 因为它似乎也可以工作,所以我认为前者只是更方便方式。 是这样还是
这个问题在这里已经有了答案: About the changing id of an immutable string (5 个回答) 关闭4年前。 为什么 "hello"is "hello" 在 P
我需要Prolog的源代码,它用于与Weka连接,并且能够在Windows环境下使用Weka算法进行预测。我尝试通过 Java 连接,但无法使用 Java 和 Prolog 进行连接和预测。 最佳答案
这个问题已经有答案了: 已关闭11 年前。 Possible Duplicate: Capitalize First Char of Each Word in a String Java 编写进行以下
当我在 ruby 控制台中运行以下示例时,我感到很惊讶。它们都产生相同的输出。 "hello".length 和 "hello" .length ruby
我创建了一个Hello World应用,系统生成了下面大部分的Android语言。在没有 System.out 语句的情况下运行应用程序时,模拟器中不会显示“Hello”。然后,使用 Eclipse
是的,所以我正在制作一个沼泽标准 Hello world 以确保 android 正常工作。这是我第一次使用 android,所以我正在设置环境。我按照以下程序制作了程序:http://develop
我是一名优秀的程序员,十分优秀!