在示例.py我的档案:
import libnet
但当我执行时:
^{pr2}$我得到了“ImportError:没有名为libnet的模块”
我如何安装它:
只是错误仍然存在,它似乎没有安装。我现在能做什么?在
谢谢你的帮助!在
/编辑:
带有:“sudo/opt/local/bin/python2.5设置.py安装“,我得到:
Searching for libnet...
running install
running build
running build_ext
building 'libnet' extension
/Developer/usr/bin/llvm-gcc-4.2 -fno-strict-aliasing -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DLIBNET_MAJOR_VERSION=1 -DLIBNET_MINOR_VERSION=1 -DLIBNET_RELEASE=5 -DMAJOR_VERSION=2 -DMINOR_VERSION=0 -I/opt/local/include -I/opt/local/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c src/libnetmodule.c -o build/temp.macosx-10.7-x86_64-2.5/src/libnetmodule.o
In file included from src/context.c:110,
from src/libnetmodule.c:37:
src/builders.c: In function 'context_build_icmpv4_timestamp':
src/builders.c:726: error: 'n_time' undeclared (first use in this function)
src/builders.c:726: error: (Each undeclared identifier is reported only once
src/builders.c:726: error: for each function it appears in.)
src/builders.c:726: error: expected ';' before 'otime'
src/builders.c:727: error: expected ';' before 'rtime'
src/builders.c:728: error: expected ';' before 'ttime'
src/builders.c:735: error: 'otime' undeclared (first use in this function)
src/builders.c:735: error: 'rtime' undeclared (first use in this function)
src/builders.c:735: error: 'ttime' undeclared (first use in this function)
error: command '/Developer/usr/bin/llvm-gcc-4.2' failed with exit status 1
在用MacPorts安装了C库之后,是否安装了下载的python
libnet
包装器?否则,cd
到去焦油pylibnet
目录并尝试:更新:根据您更新的问题,现在您似乎在
/sw
中安装了另一个版本的libnetc库,这是Fink
安装的包的默认位置。您不应该尝试混合使用包管理器。选择一个-MacPorts,Fink,或者自制是OSX上最受欢迎的——并且坚持下去。作为一个短期修复方法,您可能需要编辑setup.py
文件来删除对/sw
的搜索。你应该在某个时候评估一下你用Fink和MacPorts安装了哪些软件包,选择一个,安装其中任何缺少的端口/软件包,然后完全删除另一个软件包系统。在相关问题 更多 >
编程相关推荐