Não consigo instalar o hashlib manualmente

0

Não sei por que, mas quando estou instalando hashlib , isso me causa um erro. Já experimentei um bom número de possíveis soluções e agradeço qualquer ajuda.

$ pip install --user hashlib
Collecting hashlib
  Using cached https://files.pythonhosted.org/packages/74/bb/9003d081345e9f0451884146e9ea2cff6e4cc4deac9ffd4a9ee98b318a49/hashlib-20081119.zip
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/tania/anaconda3/lib/python3.6/site-packages/setuptools/__init__.py", line 12, in <module>
        import setuptools.version
      File "/home/tania/anaconda3/lib/python3.6/site-packages/setuptools/version.py", line 1, in <module>
        import pkg_resources
      File "/home/tania/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 36, in <module>
        import email.parser
      File "/home/tania/anaconda3/lib/python3.6/email/parser.py", line 12, in <module>
        from email.feedparser import FeedParser, BytesFeedParser
      File "/home/tania/anaconda3/lib/python3.6/email/feedparser.py", line 27, in <module>
        from email._policybase import compat32
      File "/home/tania/anaconda3/lib/python3.6/email/_policybase.py", line 9, in <module>
        from email.utils import _has_surrogates
      File "/home/tania/anaconda3/lib/python3.6/email/utils.py", line 28, in <module>
        import random
      File "/home/tania/anaconda3/lib/python3.6/random.py", line 46, in <module>
        from hashlib import sha512 as _sha512
      File "/tmp/pip-install-vm0l089t/hashlib/hashlib.py", line 80
        raise ValueError, "unsupported hash type"
                        ^
    SyntaxError: invalid syntax
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-vm0l089t/hashlib/
    
por Tan 20.05.2018 / 00:59

1 resposta

1

can't install hashlib manually

$ pip install --user hashlib

Nota 1: pip é normalmente um comando python2.

Nota 2: Um "hashlib" contemporâneo está presente por padrão:

$ locate hashlib.py
/snap/core/4486/usr/lib/python3.5/hashlib.py
/snap/core/4571/usr/lib/python3.5/hashlib.py
/snap/pulsemixer/23/usr/lib/python3.5/hashlib.py
/snap/pulsemixer/8/usr/lib/python3.5/hashlib.py
/snap/software-boutique/31/usr/lib/python3.5/hashlib.py
/snap/ubuntu-mate-welcome/169/usr/lib/python3.5/hashlib.py
/usr/lib/python2.7/hashlib.py
/usr/lib/python2.7/hashlib.pyc
/usr/lib/python3.6/hashlib.py

Hashlib-2008: Como o nome diz → ano 2008: Arquivos antigos geralmente falharão com gcc-7 .

Manualmente: obtenha hashlib-20081119.zip link

Exemplo com o Ubuntu 18.04 e python2 (falha com python3):

sudo apt install g++ g++-5

unzip hashlib-20081119.zip
cd hashlib-20081119/
export CC=gcc-5 && python setup.py build && sudo python setup.py install
.
.
Writing /usr/local/lib/python2.7/dist-packages/hashlib-20081119.egg-info
    
por Knud Larsen 20.05.2018 / 15:17

Tags