我正在运行OSX ElCapitan并且我已经安装了easysnmp ...然而,当我尝试在python上导入它时,我收到以下错误:
Python 2.7.12 (default, Jun 29 2016, 14:05:02)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> from easysnmp import Session
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/easysnmp/__init__.py", line 1, in <module>
from .easy import ( # noqa
File "/usr/local/lib/python2.7/site-packages/easysnmp/easy.py", line 3, in <module>
from .session import Session
File "/usr/local/lib/python2.7/site-packages/easysnmp/session.py", line 8, in <module>
from . import interface
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/easysnmp/interface.so, 2): Symbol not found: _netsnmp_transport_config_compare
Referenced from: /usr/local/lib/python2.7/site-packages/easysnmp/interface.so
Expected in: flat namespace
in /usr/local/lib/python2.7/site-packages/easysnmp/interface.so
easysnmp网站声称它需要net-snmp 5.7虽然el capitan随附了5.6 ...所以我已经安装了啤酒&#34; snmp-get 5.7。
Brew不会更改符号链接,因此我假设python仍在查看版本5.6。
安装输出:
==> make
==> make install
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.
OS X already provides this software and installing another version in
the parallel can cause all kinds of trouble.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/net-snmp/lib
CPPFLAGS: -I/usr/local/opt/net-snmp/include
==> Summary
/usr/local/Cellar/net-snmp/5.7.3: 538 files, 12.8M, built in 4 minutes 34 seconds