无法执行“python setup.py build”命令..!

时间:2013-02-24 04:42:40

标签: python gcc build setup.py

我正在尝试在BACKTRACK 5 R1虚拟机上安装 pylorcon-1 (用于编写无线数据包嗅探器的Lorcon的python包装器)...我从[Pylorcon]下载的软件包官方页面[1]有3个文件pylorcon.c,setup.py和tx.py ..所以在README文件中给出了我试图执行命令...

python setup.py build

执行上述命令后,我得到以下输出:

running build 
running build_ext
building 'pylorcon' extension 
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c pylorcon.c -o build/temp.linux-i686-2.6/pylorcon.o 
pylorcon.c:8:20: error: Python.h: No such file or directory
pylorcon.c:9:26: error: structmember.h: No such file or directory
pylorcon.c:10:21: error: tx80211.h: No such file or directory
pylorcon.c:11:28: error: tx80211_packet.h: No such file or directory
pylorcon.c:13: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:16: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:74: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:81: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:118: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
pylorcon.c: In function ‘Lorcon_dealloc’:
pylorcon.c:128: warning: implicit declaration of function ‘tx80211_getmode’
pylorcon.c:128: error: ‘Lorcon’ has no member named ‘in_tx’
pylorcon.c:129: warning: implicit declaration of function ‘tx80211_close’
pylorcon.c:129: error: ‘Lorcon’ has no member named ‘in_tx’
pylorcon.c:131: error: ‘Lorcon’ has no member named ‘ob_type’
pylorcon.c:131: error: ‘PyObject’ undeclared (first use in this function)
pylorcon.c:131: error: (Each undeclared identifier is reported only once
pylorcon.c:131: error: for each function it appears in.)
pylorcon.c:131: error: expected expression before ‘)’ token
pylorcon.c: At top level:
pylorcon.c:136: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:151: error: expected declaration specifiers or ‘...’ before ‘PyObject’
pylorcon.c:151: error: expected declaration specifiers or ‘...’ before ‘PyObject’
pylorcon.c: In function ‘Lorcon_init’:
pylorcon.c:152: error: ‘PyObject’ undeclared (first use in this function)
pylorcon.c:152: error: ‘iface’ undeclared (first use in this function)
pylorcon.c:152: error: ‘driver’ undeclared (first use in this function)
pylorcon.c:152: warning: left-hand operand of comma expression has no effect
pylorcon.c:153: error: ‘NULL’ undeclared (first use in this function)
pylorcon.c:155: warning: implicit declaration of function ‘PyArg_ParseTupleAndKeywords’
pylorcon.c:155: error: ‘args’ undeclared (first use in this function)
pylorcon.c:155: error: ‘kwds’ undeclared (first use in this function)
pylorcon.c:161: warning: implicit declaration of function ‘Py_INCREF’
pylorcon.c:162: error: ‘Lorcon’ has no member named ‘iface’
pylorcon.c:162: warning: statement with no effect
pylorcon.c:164: error: ‘Lorcon’ has no member named ‘driver’
pylorcon.c:164: warning: statement with no effect
pylorcon.c:166: error: ‘Lorcon’ has no member named ‘drivertype’
pylorcon.c:166: warning: implicit declaration of function ‘tx80211_resolvecard’
pylorcon.c:166: warning: implicit declaration of function ‘PyString_AsString’
pylorcon.c:166: error: ‘Lorcon’ has no member named ‘driver’
pylorcon.c:166: warning: statement with no effect
pylorcon.c:168: error: ‘Lorcon’ has no member named ‘drivertype’
pylorcon.c:168: error: ‘INJ_NODRIVER’ undeclared (first use in this function)
pylorcon.c:169: warning: implicit declaration of function ‘PyErr_SetString’
pylorcon.c:169: error: ‘LorconError’ undeclared (first use in this function)
pylorcon.c:173: warning: implicit declaration of function ‘tx80211_init’
pylorcon.c:173: error: ‘Lorcon’ has no member named ‘in_tx’
pylorcon.c:173: error: ‘Lorcon’ has no member named ‘iface’
pylorcon.c:174: error: ‘Lorcon’ has no member named ‘drivertype’
pylorcon.c:175: warning: implicit declaration of function ‘tx80211_geterrstr’
pylorcon.c:175: error: ‘Lorcon’ has no member named ‘in_tx’
pylorcon.c:179: warning: implicit declaration of function ‘tx80211_open’
pylorcon.c:179: error: ‘Lorcon’ has no member named ‘in_tx’
pylorcon.c:180: error: ‘Lorcon’ has no member named ‘in_tx’
pylorcon.c:183: warning: implicit declaration of function ‘tx80211_initpacket’
pylorcon.c:183: error: ‘Lorcon’ has no member named ‘in_packet’
pylorcon.c: At top level:
pylorcon.c:191: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:196: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:201: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:238: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:269: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:297: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:310: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:327: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:372: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:422: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:455: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:496: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:502: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:523: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Lorcon_members’
pylorcon.c:527: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Lorcon_methods’
pylorcon.c:562: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘LorconType’
pylorcon.c:604: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘pylorcon_methods’
pylorcon.c: In function ‘initpylorcon’:
pylorcon.c:617: error: ‘PyObject’ undeclared (first use in this function)
pylorcon.c:617: error: ‘m’ undeclared (first use in this function)
pylorcon.c:617: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
pylorcon.c:617: warning: statement with no effect
pylorcon.c:619: warning: implicit declaration of function ‘PyType_Ready’
pylorcon.c:619: error: ‘LorconType’ undeclared (first use in this function)
pylorcon.c:622: warning: implicit declaration of function ‘Py_InitModule3’
pylorcon.c:622: error: ‘pylorcon_methods’ undeclared (first use in this function)
pylorcon.c:623: warning: statement with no effect
pylorcon.c:625: error: ‘NULL’ undeclared (first use in this function)
pylorcon.c:628: error: ‘LorconError’ undeclared (first use in this function)
pylorcon.c:628: warning: implicit declaration of function ‘PyErr_NewException’
pylorcon.c:628: warning: statement with no effect
pylorcon.c:630: warning: implicit declaration of function ‘PyModule_AddObject’
pylorcon.c:633: error: expected expression before ‘)’ token
pylorcon.c:633: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
error: command 'gcc' failed with exit status 1

我该如何解决这个问题?

@Ric ...我执行了你告诉我的命令 sudo apt-get install python-dev ,然后又执行了命令 python setup.py build 我得到了以下输出:

运行构建
运行build_ext
建筑' pylorcon'扩展
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I / usr / include / python2.6 -c pylorcon.c -o build / temp.linux-i686- 2.6 / pylorcon.o pylorcon.c:10:21:错误:tx80211.h:没有这样的文件或目录
pylorcon.c:11:28:错误:tx80211_packet.h:没有这样的文件或目录
pylorcon.c:在函数'capToList'中:
pylorcon.c:20:错误:'TX80211_CAP_SNIFF'未声明(首次使用此功能)

pylorcon.c:20:错误:(每个未声明的标识符仅报告一次 pylorcon.c:20:错误:对于它出现的每个函数。)
pylorcon.c:23:错误:'TX80211_CAP_TRANSMIT'未声明(首次使用此功能)

pylorcon.c:26:错误:'TX80211_CAP_SEQ'未声明(首次使用此功能)
pylorcon.c:29:错误:'TX80211_CAP_BSSTIME'未声明(首次使用此功能)

pylorcon.c:32:错误:'TX80211_CAP_FRAG'未声明(首次使用此功能)

pylorcon.c:35:错误:'TX80211_CAP_CTRL'未声明(首次使用此功能)
pylorcon.c:38:错误:'TX80211_CAP_DURID'未声明(首次使用此功能)
pylorcon.c:41:错误:'TX80211_CAP_SNIFFACK'未声明(首次使用此功能)
pylorcon.c:44:错误:'TX80211_CAP_SELFACK'未声明(首次使用此功能)
pylorcon.c:47:错误:'TX80211_CAP_TXNOWAIT'未声明(首次使用此功能)
pylorcon.c:50:错误:'TX80211_CAP_DSSSTX'未声明(首次使用此功能)
pylorcon.c:53:错误:'TX80211_CAP_OFDMTX'未声明(首次使用此功能)
pylorcon.c:56:错误:'TX80211_CAP_MIMOTX'未声明(首次使用此功能)
pylorcon.c:59:错误:'TX80211_CAP_SETRATE'未声明(首次使用此功能)

pylorcon.c:62:错误:'TX80211_CAP_SETMODULATION'未声明(首次使用此功能)
pylorcon.c:65:错误:'TX80211_CAP_NONE'未声明(首次使用此功能)

pylorcon.c:在函数'pylorcon_getversion'中:
pylorcon.c:75:警告:隐式声明函数'tx80211_getversion'
pylorcon.c:在函数'pylorcon_getcardlist'中:
pylorcon.c:86:警告:隐式声明函数'tx80211_getcardlist'
pylorcon.c:86:警告:赋值使整数指针没有强制转换 pylorcon.c:91:错误:解除指向不完整类型的指针
pylorcon.c:96:错误:解除指向不完整类型的指针
pylorcon.c:103:错误:解除指向不完整类型的指针
pylorcon.c:105:错误:解除指向不完整类型的指针
pylorcon.c:111:警告:隐式声明函数'tx80211_freecardlist'
pylorcon.c:顶层:
pylorcon.c:119:错误:字段'in_tx'的类型不完整
pylorcon.c:120:错误:字段'in_packet'的类型不完整
pylorcon.c:在函数'Lorcon_dealloc'中:
pylorcon.c:128:警告:函数'tx80211_getmode'的隐式声明 pylorcon.c:129:警告:隐式声明函数'tx80211_close'
pylorcon.c:在函数'Lorcon_new'中:
pylorcon.c:142:错误:'INJ_NODRIVER'未声明(首次使用此功能)
pylorcon.c:在函数'Lorcon_init'中:
pylorcon.c:166:警告:隐式声明函数'tx80211_resolvecard'
pylorcon.c:168:错误:'INJ_NODRIVER'未声明(首次使用此功能)
pylorcon.c:173:警告:隐式声明函数'tx80211_init'
pylorcon.c:175:警告:函数'tx80211_geterrstr'的隐式声明 pylorcon.c:179:警告:隐式声明函数'tx80211_open'
pylorcon.c:183:警告:隐式声明函数'tx80211_initpacket'
pylorcon.c:在函数'Lorcon_getmode'中:
pylorcon.c:210:错误:'TX80211_MODE_AUTO'未声明(首次使用此功能)
pylorcon.c:213:错误:'TX80211_MODE_ADHOC'未声明(首次使用此功能)
pylorcon.c:216:错误:'TX80211_MODE_INFRA'未声明(首次使用此功能)
pylorcon.c:219:错误:'TX80211_MODE_MASTER'未声明(首次使用此功能)
pylorcon.c:222:错误:'TX80211_MODE_REPEAT'未声明(首次使用此功能)
pylorcon.c:225:错误:'TX80211_MODE_SECOND'未声明(首次使用此功能)
pylorcon.c:228:错误:'TX80211_MODE_MONITOR'未声明(首次使用此功能)

pylorcon.c:在函数'Lorcon_setmode'中:
pylorcon.c:247:错误:'TX80211_MODE_AUTO'未声明(首次使用此功能)

pylorcon.c:249:错误:'TX80211_MODE_ADHOC'未声明(首次使用此功能)
pylorcon.c:251:错误:'TX80211_MODE_INFRA'未声明(首次使用此功能)
pylorcon.c:253:错误:'TX80211_MODE_MASTER'未声明(首次使用此功能)

pylorcon.c:255:错误:'TX80211_MODE_REPEAT'未声明(首次使用此功能)
pylorcon.c:257:错误:'TX80211_MODE_SECOND'未声明(首次使用此功能)
pylorcon.c:259:错误:'TX80211_MODE_MONITOR'未声明(首次使用此功能)
pylorcon.c:在函数'Lorcon_setfunctionalmode'中:
pylorcon.c:278:错误:'TX80211_FUNCMODE_RFMON'未声明(首次使用此功能)
pylorcon.c:280:错误:'TX80211_FUNCMODE_INJECT'未声明(首次使用此功能)
pylorcon.c:282:错误:'TX80211_FUNCMODE_INJMON'未声明(首次使用此功能)
pylorcon.c:287:警告:函数'tx80211_setfunctionalmode'的隐式声明 pylorcon.c:在函数'Lorcon_getchannel'中:
pylorcon.c:300:警告:隐式声明函数'tx80211_getchannel'
pylorcon.c:在函数'Lorcon_setchannel'中:
pylorcon.c:317:警告:隐式声明函数'tx80211_setchannel'
pylorcon.c:在函数'Lorcon_gettxrate'中:
pylorcon.c:329:警告:隐式声明函数'tx80211_gettxrate'
pylorcon.c:332:错误:'TX80211_RATE_DEFAULT'未声明(首次使用此功能)
pylorcon.c:335:错误:'TX80211_RATE_1MB'未声明(首次使用此功能)
pylorcon.c:338:错误:'TX80211_RATE_2MB'未声明(首次使用此功能)
pylorcon.c:341:错误:'TX80211_RATE_5_5MB'未声明(首次使用此功能)
pylorcon.c:344:错误:'TX80211_RATE_6MB'未声明(首次使用此功能)

pylorcon.c:347:错误:'TX80211_RATE_9MB'未声明(首次使用此功能)

pylorcon.c:350:错误:'TX80211_RATE_11MB'未声明(首次使用此功能)
pylorcon.c:353:错误:'TX80211_RATE_24MB'未声明(首次使用此功能)

pylorcon.c:356:错误:'TX80211_RATE_36MB'未声明(首次使用此功能)
pylorcon.c:359:错误:'TX80211_RATE_48MB'未声明(首次使用此功能)
pylorcon.c:362:错误:'TX80211_RATE_108MB'未声明(首次使用此功能)
pylorcon.c:在函数'Lorcon_settxrate'中:
pylorcon.c:376:警告:函数'tx80211_getcapabilities'的隐式声明 pylorcon.c:376:错误:'TX80211_CAP_SETRATE'未声明(首次使用此功能)

pylorcon.c:386:错误:'TX80211_RATE_DEFAULT'未声明(首次使用此功能)

pylorcon.c:388:错误:'TX80211_RATE_1MB'未声明(首次使用此功能)

pylorcon.c:390:错误:'TX80211_RATE_2MB'未声明(首次使用此功能)
pylorcon.c:392:错误:'TX80211_RATE_5_5MB'未声明(首次使用此功能)
pylorcon.c:394:错误:'TX80211_RATE_6MB'未声明(首次使用此功能)

pylorcon.c:396:错误:'TX80211_RATE_9MB'未声明(首次使用此功能)
pylorcon.c:398:错误:'TX80211_RATE_11MB'未声明(首次使用此功能)

pylorcon.c:400:错误:'TX80211_RATE_24MB'未声明(首次使用此功能)

pylorcon.c:402:错误:'TX80211_RATE_36MB'未声明(首次使用此功能)
pylorcon.c:404:错误:'TX80211_RATE_48MB'未声明(首次使用此功能)

pylorcon.c:406:错误:'TX80211_RATE_108MB'未声明(首次使用此功能)
pylorcon.c:412:警告:隐式声明函数'tx80211_settxrate'
pylorcon.c:在函数'Lorcon_getmodulation'中:
pylorcon.c:425:警告:隐式声明函数'tx80211_getmodulation'
pylorcon.c:427:错误:'TX80211_MOD_DEFAULT'未声明(首次使用此功能)
pylorcon.c:430:错误:'TX80211_MOD_FHSS'未声明(首次使用此功能)
pylorcon.c:433:错误:'TX80211_MOD_DSSS'未声明(首次使用此功能)

pylorcon.c:436:错误:'TX80211_MOD_OFDM'未声明(首次使用此功能)
pylorcon.c:439:错误:'TX80211_MOD_TURBO'未声明(首次使用此功能)

pylorcon.c:442:错误:'TX80211_MOD_MIMO'未声明(首次使用此功能)
pylorcon.c:445:错误:'TX80211_MOD_MIMOGF'未声明(首次使用此功能)
pylorcon.c:在函数'Lorcon_setmodulation'中:
pylorcon.c:459:错误:'TX80211_CAP_SETMODULATION'未声明(首次使用此功能)
pylorcon.c:469:错误:'TX80211_MOD_DEFAULT'未声明(首次使用此功能)
pylorcon.c:471:错误:'TX80211_MOD_FHSS'未声明(首次使用此功能)
pylorcon.c:473:错误:'TX80211_MOD_DSSS'未声明(首次使用此功能)
pylorcon.c:475:错误:'TX80211_MOD_OFDM'未声明(首次使用此功能)
pylorcon.c:477:错误:'TX80211_MOD_TURBO'未声明(首次使用此功能)
pylorcon.c:479:错误:'TX80211_MOD_MIMO'未声明(首次使用此功能)

pylorcon.c:481:错误:'TX80211_MOD_MIMOGF'未声明(首次使用此功能)
pylorcon.c:487:警告:隐式声明函数'tx80211_setmodulation'
pylorcon.c:在函数'Lorcon_txpacket'中:
pylorcon.c:514:警告:隐式声明函数'tx80211_txpacket'
错误:命令' gcc'退出状态失败

1 个答案:

答案 0 :(得分:3)

您需要为您的操作系统安装所需的开发标题。

来自Building pylorcon2 page

$ sudo apt-get install libpcap-dev libnl-dev python-dev

如果您仍然遇到问题,请按照其余说明进行操作。