[英]ImportError: dlopen(/usr/local/lib/python2.7/site-packages/_geoslib.so
[英]Python OSX - flat namespace in /usr/local/lib/python2.7/site-packages/easysnmp/interface.so
我可以在這篇文章中看到類似的問題https://github.com/fgimian/easysnmp/issues/42但我不確定是否同樣的問題適用於我。
基本上我已經通過home-brew安裝了python
alexs-mbp:~ alex$ which python
/usr/local/bin/python
alexs-mbp:~ alex$
並通過pip和net-snmp通過home-brew安裝easysnmp
alexs-mbp:~alex$ python
Python 2.7.13 (default, Dec 18 2016, 07:03:39)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import easysnmp
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
使用brew進行檢查時,我也收到此消息
Warning: net-snmp is a keg-only and another version is linked to opt.
Use `brew install --force` if you want to install this version
alexs-mbp:~ alex$ brew install net-snmp --force
Warning: net-snmp-5.7.3 already installed, it's just not linked.
alexs-mbp:~ alex$
我做了一個brew鏈接,它給了我以下
Warning: net-snmp is a keg-only and another version is linked to opt.
Use `brew install --force` if you want to install this version
alexs-mbp:~ alex$ brew install net-snmp --force
Warning: net-snmp-5.7.3 already installed, it's just not linked.
alexs-mbp:~ alex$ brew link net-snmp
Warning: net-snmp is keg-only and must be linked with --force
Note that doing so can interfere with building software.
If you need to have this software first in your PATH instead consider running:
echo 'export PATH="/usr/local/opt/net-snmp/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/net-snmp/sbin:$PATH"' >> ~/.bash_profile
alexs-mbp:~ alexwilloughby$ brew link net-snmp --force
Linking /usr/local/Cellar/net-snmp/5.7.3... 182 symlinks created
If you need to have this software first in your PATH instead consider running:
echo 'export PATH="/usr/local/opt/net-snmp/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/net-snmp/sbin:$PATH"' >> ~/.bash_profile
alexs-mbp:~ alex$
啟動python和導入easysnmp仍然給我同樣的錯誤,有誰知道如何解決這個問題?
謝謝
問題似乎源於net-snmp的homebrew安裝和easysnmp的pip安裝的不兼容性。 嘗試卸載easysnmp並從此fork重新安裝https://github.com/kamakazikamikaze/easysnmp :
pip uninstall easysnmp
pip install git+https://github.com/kamakazikamikaze/easysnmp.git
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.