zoukankan      html  css  js  c++  java
  • Python paramiko安装报错

    报错:CryptographyDeprecationWarning

    代码引用:

    import paramiko
    client = paramiko.SSHClient()
    client.connect(serverIp, port=serverPort, username=serverUser)
    

    报警告如下:

    paramikoecdsakey.py:164: CryptographyDeprecationWarning: Support for unsafe construction of public numbers from encoded data will be removed in a future version. Please use EllipticCurvePublicKey.from_encoded_point
      self.ecdsa_curve.curve_class(), pointinfo
    paramikokex_ecdh_nist.py:39: CryptographyDeprecationWarning: encode_point has been deprecated on EllipticCurvePublicNumbers and will be removed in a future version. Please use EllipticCurvePublicKey.public_bytes to obtain both compressed and uncompressed point encoding.
      m.add_string(self.Q_C.public_numbers().encode_point())
    paramikokex_ecdh_nist.py:96: CryptographyDeprecationWarning: Support for unsafe construction of public numbers from encoded data will be removed in a future version. Please use EllipticCurvePublicKey.from_encoded_point
      self.curve, Q_S_bytes
    paramikokex_ecdh_nist.py:111: CryptographyDeprecationWarning: encode_point has been deprecated on EllipticCurvePublicNumbers and will be removed in a future version. Please use EllipticCurvePublicKey.public_bytes to obtain both compressed and uncompressed point encoding.
      hm.add_string(self.Q_C.public_numbers().encode_point())
    

    原因

    paramiko 2.4.2 依赖 cryptography,而最新的cryptography==2.5里有一些弃用的API。
    

    解决

    删掉cryptography 2.5,安装2.4.2,就不会报错了。

    pip uninstall cryptography==2.5
    pip install cryptography==2.4.2
    

    补充

    paramiko的issue #1369提到了这个问题,并已有PR #1379了,尚未合并。

  • 相关阅读:
    JS高级-虚拟DOM
    JS高级-异步
    tomcat server.xml中文版
    java中的等于
    eclipse version
    angularjs中父,子,兄之间controller值得传递
    《那一天,那一月,那一年,那一世》-------仓央嘉措
    用jsonp格式的数据进行ajax post请求变成get
    git常用指令
    让div支持placeholder属性/模拟输入框的placeholder属性
  • 原文地址:https://www.cnblogs.com/meilong/p/Python-paramiko-an-zhuang-bao-cuo.html
Copyright © 2011-2022 走看看