本文介绍了使用python 2.7而不是2.6导入hashlib时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Solaris 10(x86)上.

I'm on Solaris 10 (x86).

直到现在,我一直在使用python2.6.今天,我安装了python2.7,在2.7而不是2.6上导入hashlib时发生奇怪的错误:

Until now, I was using python2.6. Today, I installed python2.7 and I have a weird error occuring when importing hashlib on 2.7, but not on 2.6:

Python 2.6:

Python 2.6:

root@myserver [PROD] # python2.6 -c "import hashlib"
root@myserver [PROD] #

Python 2.7:

Python 2.7:

root@myserver [PROD] # python2.7 -c "import hashlib"
ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha1
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512

我不知道为什么会出现此错误,因为我尝试在同一台机器上导入.

I don't understand why I have this error since I'm trying the import ON THE SAME MACHINE.

提前感谢您的帮助!

推荐答案

python2.7软件包依赖于libssl1_0_0软件包(openssl_1.0运行时库).

The python2.7 package is dependent to the libssl1_0_0 package (openssl_1.0 runtime librairies).

我安装了它,并在$LD_LIBRARY_PATH环境变量中添加了/usr/local/ssl/lib目录.

I installed it, and added the /usr/local/ssl/lib directory in $LD_LIBRARY_PATH environnent variable.

现在它可以完美运行了! :)

And now it works perfectly! :)

这篇关于使用python 2.7而不是2.6导入hashlib时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 13:45