2

我正在运行 OSX ElCapitan 并且我已经 brew install 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 ......所以我已经“安装了 brew”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
4

0 回答 0