简体   繁体   English

Mac OS X:无法通过pip安装easysnmp

[英]Mac OS X: unable to install easysnmp via pip

I'm trying to install python easysnmp package via pip on Mac OS but got following issue 我正在尝试在Mac OS上通过pip安装python easysnmp软件包,但出现以下问题

➜  ~ pip install easysnmp
Collecting easysnmp
  Using cached https://files.pythonhosted.org/packages/e0/6f/2fd5c9113a488c81aa95f9006744c6998878a80135010f87506638ba6d5c/easysnmp-0.2.5.tar.gz
Installing collected packages: easysnmp
  Running setup.py install for easysnmp ... error
    ERROR: Complete output from command /Users/luk/.pyenv/versions/3.6.5/bin/python3.6 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/hz/xgmhyb9x6c907lm81h82g1tm3znyk3/T/pip-install-u6hwnvnm/easysnmp/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/hz/xgmhyb9x6c907lm81h82g1tm3znyk3/T/pip-record-wvtda6_o/install-record.txt --single-version-externally-managed --compile:
    ERROR: running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.14-x86_64-3.6
    creating build/lib.macosx-10.14-x86_64-3.6/easysnmp
    copying easysnmp/compat.py -> build/lib.macosx-10.14-x86_64-3.6/easysnmp
    copying easysnmp/variables.py -> build/lib.macosx-10.14-x86_64-3.6/easysnmp
    copying easysnmp/session.py -> build/lib.macosx-10.14-x86_64-3.6/easysnmp
    copying easysnmp/__init__.py -> build/lib.macosx-10.14-x86_64-3.6/easysnmp
    copying easysnmp/easy.py -> build/lib.macosx-10.14-x86_64-3.6/easysnmp
    copying easysnmp/utils.py -> build/lib.macosx-10.14-x86_64-3.6/easysnmp
    copying easysnmp/exceptions.py -> build/lib.macosx-10.14-x86_64-3.6/easysnmp
    copying easysnmp/helpers.py -> build/lib.macosx-10.14-x86_64-3.6/easysnmp
    running build_ext
    building 'easysnmp.interface' extension
    creating build/temp.macosx-10.14-x86_64-3.6
    creating build/temp.macosx-10.14-x86_64-3.6/easysnmp
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -I/usr/local/opt/zlib/include -I/Users/vyah/.pyenv/versions/3.6.5/include/python3.6m -c easysnmp/interface.c -o build/temp.macosx-10.14-x86_64-3.6/easysnmp/interface.o -Wno-unused-function
    In file included from easysnmp/interface.c:46:
    easysnmp/simple_bitarray.h:116:29: warning: variable 'nbytes' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
                for (i = nbits; i > (nbits - remaining_bits); i--)
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    easysnmp/simple_bitarray.h:122:27: note: uninitialized use occurs here
            memset(&ba[1], 0, nbytes);
                              ^~~~~~
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:76:33: note: expanded from macro 'memset'
                    __builtin___memset_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
                                                  ^~~~~~~~~~~
    easysnmp/simple_bitarray.h:116:29: note: remove the condition if it is always true
                for (i = nbits; i > (nbits - remaining_bits); i--)
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    easysnmp/simple_bitarray.h:98:22: note: initialize the variable 'nbytes' to silence this warning
            size_t nbytes;
                         ^
                          = 0
    easysnmp/interface.c:454:25: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
                    if (len > buf_len)
                        ~~~ ^ ~~~~~~~
    easysnmp/interface.c:1220:48: warning: comparison of integers of different signs: 'unsigned long' and 'long' [-Wsign-compare]
                            else if (last_errindex > (*response)->errindex)
                                     ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~
    easysnmp/interface.c:2379:55: warning: comparison of integers of different signs: 'unsigned long' and 'int' [-Wsign-compare]
            if (snmp_version == 1 && DEFAULT_NUM_BAD_OIDS < varlist_len)
                                     ~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~
    easysnmp/interface.c:2853:44: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
                        if ((vars->name_length < oid_arr_len[varlist_ind]) ||
                             ~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~
    easysnmp/interface.c:3584:48: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
                            if ((vars->name_length < oid_arr_len[varlist_ind]) ||
                                 ~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~
    easysnmp/interface.c:3889:28: warning: comparison of integers of different signs: 'Py_ssize_t' (aka 'long') and 'unsigned long' [-Wsign-compare]
                    if (tmplen >= sizeof(tmp_val_str))
                        ~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~
    7 warnings generated.
    clang -bundle -undefined dynamic_lookup -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl/lib -L/Users/luk/.pyenv/versions/3.6.5/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl/lib -L/Users/luk/.pyenv/versions/3.6.5/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/zlib/lib -I/usr/local/opt/zlib/include build/temp.macosx-10.14-x86_64-3.6/easysnmp/interface.o -lnetsnmp -lcrypto.35 -o build/lib.macosx-10.14-x86_64-3.6/easysnmp/interface.cpython-36m-darwin.so
    ld: library not found for -lcrypto.35
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    error: command 'clang' failed with exit status 1
    ----------------------------------------
ERROR: Command "/Users/luk/.pyenv/versions/3.6.5/bin/python3.6 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/hz/xgmhyb9x6c907lm81h82g1tm3znyk3/T/pip-install-u6hwnvnm/easysnmp/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/hz/xgmhyb9x6c907lm81h82g1tm3znyk3/T/pip-record-wvtda6_o/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/hz/xgmhyb9x6c907lm81h82g1tm3znyk3/T/pip-install-u6hwnvnm/easysnmp/

I use pyenv , python 3.6.5 , pip 19.1.1 and Mac OS Mojave 10.14.3 . 我使用pyenvpython 3.6.5pip 19.1.1Mac OS Mojave 10.14.3 In addition, I have already installed net-snmp 5.8 and gcc 9.1 dependencies: 另外,我已经安装了net-snmp 5.8gcc 9.1依赖项:

➜  ~ python -V
Python 3.6.5
➜  ~ pip -V
pip 19.1.1 from /3.6.5/lib/python3.6/site-packages/pip (python 3.6)
➜  ~ pyenv -v
pyenv 1.2.9
➜  ~ brew info net-snmp
net-snmp: stable 5.8 (bottled) [keg-only]
Implements SNMP v1, v2c, and v3, using IPv4 and IPv6
➜  ~ brew info gcc
gcc: stable 9.1.0 (bottled), HEAD

I installed easysnmp successfully on Ubuntu after I did dependencies installation via apt-get install -y libsnmp-dev snmp libyaml-dev gcc , but haven't found an alternative for Mac OS yet. 我通过apt-get install -y libsnmp-dev snmp libyaml-dev gcc进行依赖项安装后,在Ubuntu上成功安装了easysnmp ,但尚未找到Mac OS的替代方案。 I would appreciate any help, thanks! 我将不胜感激,谢谢!

Finally I have found a solution, seems like my /usr/local/opt/openssl/lib folder did not contain libcrypto.35.dylib library. 终于我找到了一个解决方案,似乎我的/usr/local/opt/openssl/lib文件夹中没有libcrypto.35.dylib库。 Fortunatelly libcrypto.35.dylib was located in /usr/lib folder, so solution was pretty obvious to put libcrypto.35.dylib library into /usr/local/opt/openssl/lib folder. Fortunatelly libcrypto.35.dylib位于/usr/lib文件夹中,因此将libcrypto.35.dylib库放入/usr/local/opt/openssl/lib文件夹的解决方案非常明显。

As a result I created a symbolic link via 结果,我通过创建了一个符号链接

➜ ls -s /usr/lib/libcrypto.35.dylib /usr/local/opt/openssl/lib/libcrypto.35.dylib

And only then I was able to install easysnmp via pip 直到那时我才能够通过pip安装easysnmp

➜ pip install easysnmp
Collecting easysnmp
  Using cached https://files.pythonhosted.org/packages/e0/6f/2fd5c9113a488c81aa95f9006744c6998878a80135010f87506638ba6d5c/easysnmp-0.2.5.tar.gz
Installing collected packages: easysnmp
  Running setup.py install for easysnmp ... done
Successfully installed easysnmp-0.2.5

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM