python-3.x - 无法在 python 3.x 中安装 wsgiref

标签 python-3.x wsgiref

我无法在 python 3 中安装 wsgiref。我收到了这些错误。
我正在使用 python 3,但我无法安装 wsgiref
我试过 pip install wsgirefpip install wsgiref==0.1.2

E:\CodeWork\Machine Learning\SWATI-The-Assistant-master\SWATI-The-Assistant-master>pip install wsgiref==0.1.2
Collecting wsgiref==0.1.2
  Using cached https://files.pythonhosted.org/packages/41/9e/309259ce8dff8c596e8c26df86dbc4e848b9249fd36797fd60be456f03fc/wsgiref-0.1.2.zip
    ERROR: Command errored out with exit status 1:
     command: 'c:\program files\python37\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\hp\\AppData\\Local\\Temp\\pip-install-h2ydr_0e\\wsgiref\\setup.py'"'"'; __file__='"'"'C:\\Users\\hp\\AppData\\Local\\Temp\\pip-install-h2ydr_0e\\wsgiref\\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 'C:\Users\hp\AppData\Local\Temp\pip-install-h2ydr_0e\wsgiref\pip-egg-info'
         cwd: C:\Users\hp\AppData\Local\Temp\pip-install-h2ydr_0e\wsgiref\
    Complete output (8 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\hp\AppData\Local\Temp\pip-install-h2ydr_0e\wsgiref\setup.py", line 5, in <module>
        import ez_setup
      File "C:\Users\hp\AppData\Local\Temp\pip-install-h2ydr_0e\wsgiref\ez_setup\__init__.py", line 170
        print "Setuptools version",version,"or greater has been installed."
                                 ^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Setuptools version",version,"or greater has been installed.")?
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.```

最佳答案

pip 3 install 出错的原因是安装过程中打印语句之一的语法是旧的 python 2 样式,没有括号。好消息是 wsgiref 默认已经包含在 python 3 库中。启动一个 python 3 shell 并尝试输入“import wsgiref”,这应该会成功并且没有错误。

关于python-3.x - 无法在 python 3.x 中安装 wsgiref,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59473303/

相关文章:

python - Bottle 的内置 WSGI 服务器与标准 Python wsgiref 服务器模块有何不同?

python - 在谷歌应用引擎中,如何遍历表单字段(python,wsgiref.handlers)

python - 几次请求后 wsgiref.simple_server 出现奇怪的滞后/延迟/延迟/任何问题

python - 如何将 str 转换为 bytes

python - 从整数列表中查找除数最多的整数

python - 当 WSGI 应用程序在使用环境 ['wsgi.input' 之前响应时发生 TCP 连接重置]

python - 写入 csv,每个项目位于单独的列中

Python 3 在划分两个大数时给出错误的输出?

python - 在 python 中基于列表理解的条件跳过元素