web-dev-qa-db-fra.com

Python 2.7 ne fonctionne plus: impossible d'importer le nom md5

J'ai installé python 3.6.3 sur mon serveur hier (Ubuntu 14.04), et maintenant je ne peux pas exécuter Python 2.7 (dans les envs virtuels et sur «env principal»).

J'ai cherché sur Google pour cela, sans succès. 

J'ai essayé de ré-installer OpenSL car je rouge.

Quelqu'un peut-il m'aider ? Je deviens fou.

---> Voici le message à chaque fois que j'essayais d'exécuter un script Python (ou pip):

*ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
 File "/usr/local/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/lib/python2.7/hashlib.py", line 97, 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 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/lib/python2.7/hashlib.py", line 97, 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 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/lib/python2.7/hashlib.py", line 97, 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 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/lib/python2.7/hashlib.py", line 97, in     __get_builtin_constructoremphasized text
    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 147, in <module>
globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/lib/python2.7/hashlib.py", line 97, 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 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/lib/python2.7/hashlib.py", line 97, in     __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512
Traceback (most recent call last):
  File "/var/www/QuantEngine/prod/QuantScripts/QuantEngineCli.py", line     11, in <module>
    from services import DataStructureManager, DatabaseFsHelper, Orchestra, BacktestManager
  File "/var/www/QuantEngine/prod/QuantScripts/services/__init__.py", line 8, in <module>
    from BuySellManager import BuySellManager
  File "/var/www/QuantEngine/prod/QuantScripts/services/BuySellManager.py", line 1, in <module>
    import requests
  File "/var/www/QuantEngine/venv/lib/python2.7/site-    packages/requests/__init__.py", line 43, in <module>
    import urllib3
  File "/var/www/QuantEngine/venv/lib/python2.7/site-    packages/urllib3/__init__.py", line 8, in <module>
    from .connectionpool import (
  File "/var/www/QuantEngine/venv/lib/python2.7/site-    packages/urllib3/connectionpool.py", line 29, in <module>
    from .connection import (
  File "/var/www/QuantEngine/venv/lib/python2.7/site-packages/urllib3/connection.py", line 39, in <module>
from .util.ssl_ import (
  File "/var/www/QuantEngine/venv/lib/python2.7/site-    packages/urllib3/util/__init__.py", line 6, in <module>
    from .ssl_ import (
  File "/var/www/QuantEngine/venv/lib/python2.7/site-    packages/urllib3/util/ssl_.py", line 7, in <module>
    from hashlib import md5, sha1, sha256
ImportError: cannot import name md5*
8
JulienCoo

Dans ce post pourrait être une solution:

Le package python2.7 dépend du package libssl1_0_0 (librairies d'exécution openssl_1.0).

Vous devez donc l’installer et ajouter le répertoire/usr/local/ssl/lib dans la variable d’environnement $ LD_LIBRARY_PATH.

2
Vasily Bronsky