在Mac OS上安装pip3失败

时间:2020-08-08 13:00:46

标签: python-3.x ssl pip openssl

我试图在Mac OS 10.14上使用pip3版本20.2.1安装ssl模块,这会给我以下错误:

命令:pip3 install ssl

ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/nj/5mklr5y50b1d58zr4w_06k1c0000gp/T/pip-install-7az75aro/ssl/setup.py'"'"'; __file__='"'"'/private/var/folders/nj/5mklr5y50b1d58zr4w_06k1c0000gp/T/pip-install-7az75aro/ssl/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 /private/var/folders/nj/5mklr5y50b1d58zr4w_06k1c0000gp/T/pip-pip-egg-info-9we57qa4
         cwd: /private/var/folders/nj/5mklr5y50b1d58zr4w_06k1c0000gp/T/pip-install-7az75aro/ssl/
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/nj/5mklr5y50b1d58zr4w_06k1c0000gp/T/pip-install-7az75aro/ssl/setup.py", line 33
        print 'looking for', f
              ^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print('looking for', f)?
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

ssl模块本身有问题吗?

1 个答案:

答案 0 :(得分:2)

您不需要为Python 3安装SSL软件包。它是built-in module

Pypi上的SSL package解释了其目的:

套接字上的TLS的旧socket.ssl()支持已被取代 在Python 2.6中通过新的“ ssl”模块实现。这个包带来了那个模块 到较旧的Python版本2.3.5及更高版本(它可能也适用于较旧的Python版本) 版本2.3,但我们尚未尝试过。)