尝试在Mac(OS Catalina)上安装ssh2-python时遇到问题

时间:2020-03-22 20:47:42

标签: python macos terminal pip macos-catalina

我正在尝试下载ssh2-python,但继续出现此错误。我看到以前的一篇文章说要下载cmake来解决此问题,但不幸的是它没有帮助我。关于如何解决以下错误的任何建议?谢谢!

pip3 install ssh2-python

Collecting ssh2-python

  Using cached ssh2-python-0.18.0.post1.tar.gz (1.1 MB)

Installing collected packages: ssh2-python 

    Running setup.py install for ssh2-python ... error
    ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/fv/m4glr2xj7fzd20dv5pk9bs1c0000gn/T/pip-install-3kzvpatz/ssh2-python/setup.py'"'"'; __file__='"'"'/private/var/folders/fv/m4glr2xj7fzd20dv5pk9bs1c0000gn/T/pip-install-3kzvpatz/ssh2-python/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/fv/m4glr2xj7fzd20dv5pk9bs1c0000gn/T/pip-record-51uifsty/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/ssh2-python
         cwd: /private/var/folders/fv/m4glr2xj7fzd20dv5pk9bs1c0000gn/T/pip-install-3kzvpatz/ssh2-python/
    Complete output (10 lines):
    /bin/sh: cmake: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/fv/m4glr2xj7fzd20dv5pk9bs1c0000gn/T/pip-install-3kzvpatz/ssh2-python/setup.py", line 36, in <module>
        build_ssh2()
      File "/private/var/folders/fv/m4glr2xj7fzd20dv5pk9bs1c0000gn/T/pip-install-3kzvpatz/ssh2-python/_setup_libssh2.py", line 21, in build_ssh2
        check_call('cmake ../libssh2 -DBUILD_SHARED_LIBS=ON \
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 364, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command 'cmake ../libssh2 -DBUILD_SHARED_LIBS=ON     -DENABLE_ZLIB_COMPRESSION=ON -DENABLE_CRYPT_NONE=ON     -DENABLE_MAC_NONE=ON -DCRYPTO_BACKEND=OpenSSL' returned non-zero exit status 127.
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/fv/m4glr2xj7fzd20dv5pk9bs1c0000gn/T/pip-install-3kzvpatz/ssh2-python/setup.py'"'"'; __file__='"'"'/private/var/folders/fv/m4glr2xj7fzd20dv5pk9bs1c0000gn/T/pip-install-3kzvpatz/ssh2-python/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/fv/m4glr2xj7fzd20dv5pk9bs1c0000gn/T/pip-record-51uifsty/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/ssh2-python Check the logs for full command output.

1 个答案:

答案 0 :(得分:2)

您需要Client来编译lib。如果已安装Model,请使用以下命令安装import tensorflow.keras as keras import tensorflow.math as K import numpy ip = keras.layers.Input((56, 56, 16)) x = keras.layers.Lambda(lambda a: K.reduce_mean(a, axis=[1,2], keepdims=True))(ip) x = keras.layers.Conv2D( 4, kernel_size=[1,1], strides=[1,1], padding='same', use_bias=True, data_format="channels_last" )(x) x = keras.layers.Lambda(lambda a: a*K.sigmoid(a))(x) x = keras.layers.Conv2D( 16, kernel_size=[1,1], strides=[1,1], padding='same', use_bias=True, data_format="channels_last" )(x) x = keras.layers.Activation('sigmoid')(x) x = keras.layers.Multiply()([x, ip]) m = keras.Model(inputs=[ip], outputs=[x]) y = m.predict(numpy.random.random((2, 56, 56, 16))) print(y.shape) 。然后打开一个新的终端并尝试安装ssh2-python。

cmake