“SyntaxError:调用‘print’时缺少括号。你的意思是打印(‘寻找’,f)吗?”安装 ssl 时 [重复]

Posted

技术标签:

【中文标题】“SyntaxError:调用‘print’时缺少括号。你的意思是打印(‘寻找’,f)吗?”安装 ssl 时 [重复]【英文标题】:"SyntaxError: Missing parentheses in call to 'print'. Did you mean print('looking for', f)?" when installing ssl [duplicate] 【发布时间】:2022-01-14 07:41:20 【问题描述】:

运行 python3 -m pip install ssl 时出现此错误。我正在使用python3.9。我不知道我是否错过了依赖项或其他什么。有谁知道这可能意味着什么?谢谢!

Collecting ssl
  Using cached ssl-1.16.tar.gz (33 kB)
  Preparing metadata (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ksq1z266/ssl_4f2df792062c4e55adcde77572817d76/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ksq1z266/ssl_4f2df792062c4e55adcde77572817d76/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-8pykq_q9
       cwd: /tmp/pip-install-ksq1z266/ssl_4f2df792062c4e55adcde77572817d76/
  Complete output (6 lines):
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-ksq1z266/ssl_4f2df792062c4e55adcde77572817d76/setup.py", line 33
      print 'looking for', f
            ^
  SyntaxError: Missing parentheses in call to 'print'. Did you mean print('looking for', f)?
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/83/21/f469c9923235f8c36d5fd5334ed11e2681abad7e0032c5aba964dcaf9bbb/ssl-1.16.tar.gz#sha256=ac21156fee6aee9eb8d765bbb16f5f49492d81ff4b22f7b8fc001d2251120930 (from https://pypi.org/simple/ssl/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached ssl-1.15.tar.gz (32 kB)
  Preparing metadata (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ksq1z266/ssl_937ea02f984c47d09515df3b015f1d75/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ksq1z266/ssl_937ea02f984c47d09515df3b015f1d75/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-bhjdvuy4
       cwd: /tmp/pip-install-ksq1z266/ssl_937ea02f984c47d09515df3b015f1d75/
  Complete output (6 lines):
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-ksq1z266/ssl_937ea02f984c47d09515df3b015f1d75/setup.py", line 74
      print 'looking for', f
            ^
  SyntaxError: Missing parentheses in call to 'print'. Did you mean print('looking for', f)?
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/3a/c2/846a19d1572ec6cb8ac438d58a898de8926d32e13f0355cdf4ab00864b5f/ssl-1.15.tar.gz#sha256=1266302ce62c4b60c7ca0e1d3d104ba11d2749e5881d8ac4f006cf9a0446d589 (from https://pypi.org/simple/ssl/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement ssl (from versions: 1.15, 1.16)
ERROR: No matching distribution found for ssl

【问题讨论】:

似乎尝试安装与 Python 3 不兼容的旧版本。 ***.com/… ssl module on PyPI 将代码从 Python 2.6 反向移植到 Python 2.3、2.4 和 2.5。很古老。 【参考方案1】:

pip install ssl 用于 python 2,它已经包含在 python3 中,所以需要 pip 安装它 你可以查看this *** for more details

【讨论】:

以上是关于“SyntaxError:调用‘print’时缺少括号。你的意思是打印(‘寻找’,f)吗?”安装 ssl 时 [重复]的主要内容,如果未能解决你的问题,请参考以下文章