--Environment: Cloud9
$ pip install hmac
Defaulting to user installation because normal site-packages is not writeable
Collecting hmac
Downloading hmac-20101005.tar.gz (4.5 kB)
Requirement already satisfied: setuptools in /usr/lib/python3.6/dist-packages (from hmac) (36.2.7)
Collecting hashlib
Downloading hashlib-20081119.zip (42 kB)
|████████████████████████████████| 42 kB 1.1 MB/s
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5jes0rhx/hashlib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-5jes0rhx/hashlib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-uvx1s968
cwd: /tmp/pip-install-5jes0rhx/hashlib/
Complete output (22 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.6/dist-packages/setuptools/__init__.py", line 10, in <module>
from setuptools.extern.six.moves import filter, map
File "/usr/lib/python3.6/dist-packages/setuptools/extern/__init__.py", line 1, in <module>
from pkg_resources.extern import VendorImporter
File "/usr/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 36, in <module>
import email.parser
File "/usr/lib64/python3.6/email/parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "/usr/lib64/python3.6/email/feedparser.py", line 27, in <module>
from email._policybase import compat32
File "/usr/lib64/python3.6/email/_policybase.py", line 9, in <module>
from email.utils import _has_surrogates
File "/usr/lib64/python3.6/email/utils.py", line 28, in <module>
import random
File "/usr/lib64/python3.6/random.py", line 46, in <module>
from hashlib import sha512 as _sha512
File "/tmp/pip-install-5jes0rhx/hashlib/hashlib.py", line 80
raise ValueError, "unsupported hash type"
^
SyntaxError: invalid syntax
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
It seems that hmac and hashlib are available even if you don't install them ...
Requirement already satisfied: setuptools in /usr/lib/python3.6/dist-packages (from hmac) (36.2.7)
It is written.
Once you know the result, you don't understand why you tried to install it for the time being.
Reference: python --Unsupported hash type error while installing hashlib using pip3 --Stack Overflow
I've been extremely confused with HMAC and Cloud9 for the first time, and even upgraded Python ...
OK if you write and use import hmac, hashlib