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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了无法在python 3.x中安装wsgiref。相关的知识,希望对你有一定的参考价值。

我无法在python 3中安装wsgiref。我得到了这些错误.我使用的是python 3,但我不能安装wsgiref,我试过了。pip install wsgirefpip install wsgiref==0.1.2

E:CodeWorkMachine LearningSWATI-The-Assistant-masterSWATI-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 filespython37python.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('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:UsershpAppDataLocalTemppip-install-h2ydr_0ewsgirefpip-egg-info'
         cwd: C:UsershpAppDataLocalTemppip-install-h2ydr_0ewsgiref
    Complete output (8 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:UsershpAppDataLocalTemppip-install-h2ydr_0ewsgirefsetup.py", line 5, in <module>
        import ez_setup
      File "C:UsershpAppDataLocalTemppip-install-h2ydr_0ewsgirefez_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安装出错的原因是设置过程中的一个打印语句的语法是旧的python 2风格,没有括号。好消息是wsgiref已经被默认包含在python 3库中。启动一个python 3的shell,试着输入 "import wsgiref",应该不会出错。

以上是关于无法在python 3.x中安装wsgiref。的主要内容,如果未能解决你的问题,请参考以下文章

无法在 virtualenv 中安装 mySQL-python

无法在 Python 中安装 scikit-learn

如何在 python 3.10.0 中安装 mediapipe?我无法安装它

无法在 Windows XP Professional 中安装 Python 3.5

无法在 python 3.6 中安装 pickle

无法在 PyCharm 中安装 PyTorch(Python 3.9 / macOS)