在 example.py 文件中,我有:
import libnet
但是当我通过以下方式执行它时:
/opt/local/bin/python2.5 example.py
我收到“ImportError:没有名为 libnet 的模块”
我如何尝试安装它:
- 去http://pylibnet.sourceforge.net/下载
- 阅读自述文件,上面写着:在 Mac 上编译不起作用,用 Macports 加载它并使用 python 2.5
- 安装和使用python 2.5
- 通过以下方式安装 libnet: sudo port install libnet11
- 一切似乎都很好
只是错误仍然存在,它似乎没有安装。我现在能做什么?
感谢您提供任何帮助!
/编辑:
与:“sudo /opt/local/bin/python2.5 setup.py install”,我得到:
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