安装模块pip install logging的报错信息是什么意思?

Collecting logging
  Using cached logging-0.4.9.6.tar.gz (96 kB)
  Preparing metadata (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\administrator\appdata\local\programs\python\python37\pytho
n.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\User
s\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-rtc9srqc\\logging_da0c51cd1da54df
b9010710c04d8ece1\\setup.py'"'"'; __file__='"'"'C:\\Users\\ADMINI~1\\AppData\\Lo
cal\\Temp\\pip-install-rtc9srqc\\logging_da0c51cd1da54dfb9010710c04d8ece1\\setup
.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists
(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');cod
e = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code,
__file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\ADMINI~1\AppData\Local
\Temp\pip-pip-egg-info-3rl4r_zr'
       cwd: C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-rtc9srqc\logging_da
0c51cd1da54dfb9010710c04d8ece1\
  Complete output (48 lines):
  running egg_info
  creating C:\Users\ADMINI~1\AppData\Local\Temp\pip-pip-egg-info-3rl4r_zr\loggin
g.egg-info
  writing C:\Users\ADMINI~1\AppData\Local\Temp\pip-pip-egg-info-3rl4r_zr\logging
.egg-info\PKG-INFO
  writing dependency_links to C:\Users\ADMINI~1\AppData\Local\Temp\pip-pip-egg-i
nfo-3rl4r_zr\logging.egg-info\dependency_links.txt
  writing top-level names to C:\Users\ADMINI~1\AppData\Local\Temp\pip-pip-egg-in
fo-3rl4r_zr\logging.egg-info\top_level.txt
  writing manifest file 'C:\Users\ADMINI~1\AppData\Local\Temp\pip-pip-egg-info-3
rl4r_zr\logging.egg-info\SOURCES.txt'
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-rtc9srqc\logging_da0c
51cd1da54dfb9010710c04d8ece1\setup.py", line 13, in <module>
      packages = ["logging"],
    File "c:\users\administrator\appdata\local\programs\python\python37\lib\dist
utils\core.py", line 148, in setup
      dist.run_commands()
    File "c:\users\administrator\appdata\local\programs\python\python37\lib\dist
utils\dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "c:\users\administrator\appdata\local\programs\python\python37\lib\dist
utils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "c:\users\administrator\appdata\local\programs\python\python37\lib\site
-packages\setuptools\command\egg_info.py", line 278, in run
      self.find_sources()
    File "c:\users\administrator\appdata\local\programs\python\python37\lib\site
-packages\setuptools\command\egg_info.py", line 293, in find_sources
      mm.run()
    File "c:\users\administrator\appdata\local\programs\python\python37\lib\site
-packages\setuptools\command\egg_info.py", line 524, in run
      self.add_defaults()
    File "c:\users\administrator\appdata\local\programs\python\python37\lib\site
-packages\setuptools\command\egg_info.py", line 560, in add_defaults
      sdist.add_defaults(self)
    File "c:\users\administrator\appdata\local\programs\python\python37\lib\dist
utils\command\sdist.py", line 226, in add_defaults
      self._add_defaults_python()
    File "c:\users\administrator\appdata\local\programs\python\python37\lib\site
-packages\setuptools\command\sdist.py", line 127, in _add_defaults_python
      build_py = self.get_finalized_command('build_py')
    File "c:\users\administrator\appdata\local\programs\python\python37\lib\dist
utils\cmd.py", line 298, in get_finalized_command
      cmd_obj = self.distribution.get_command_obj(command, create)
    File "c:\users\administrator\appdata\local\programs\python\python37\lib\dist
utils\dist.py", line 857, in get_command_obj
      klass = self.get_command_class(command)
    File "c:\users\administrator\appdata\local\programs\python\python37\lib\site
-packages\setuptools\dist.py", line 634, in get_command_class
      self.cmdclass[command] = cmdclass = ep.load()
    File "c:\users\administrator\appdata\local\programs\python\python37\lib\site
-packages\pkg_resources\__init__.py", line 2324, in load
      return self.resolve()
    File "c:\users\administrator\appdata\local\programs\python\python37\lib\site
-packages\pkg_resources\__init__.py", line 2330, in resolve
      module = __import__(self.module_name, fromlist=['__name__'], level=0)
    File "c:\users\administrator\appdata\local\programs\python\python37\lib\site
-packages\setuptools\command\build_py.py", line 15, in <module>
      from setuptools.lib2to3_ex import Mixin2to3
    File "c:\users\administrator\appdata\local\programs\python\python37\lib\site
-packages\setuptools\lib2to3_ex.py", line 12, in <module>
      from lib2to3.refactor import RefactoringTool, get_fixers_from_package
    File "c:\users\administrator\appdata\local\programs\python\python37\lib\lib2
to3\refactor.py", line 18, in <module>
      import logging
    File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-rtc9srqc\logging_da0c
51cd1da54dfb9010710c04d8ece1\logging\__init__.py", line 618
      raise NotImplementedError, 'emit must be implemented '\
                               ^
  SyntaxError: invalid syntax
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/93/4b/979db9e44be09f
71e85c9c8cfc42f258adfb7d93ce01deed2788b2948919/logging-0.4.9.6.tar.gz#sha256=26f
6b50773f085042d301085bd1bf5d9f3735704db9f37c1ce6d8b85c38f2417 (from https://pypi
.org/simple/logging/). Command errored out with exit status 1: python setup.py e
gg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement logging (from ver
sions: 0.4.9.6)
ERROR: No matching distribution found for logging
阅读 9.5k
1 个回答

从报错来看,应该是使用 Python3 中的 pip3 尝试安装 logging 这个包,而这个实际上是个 Python2 语法的包,所以报语法错误。
用 Python2 中 pip 安装就不会报错,但 logging 是内置库,理论上是不需要安装的,怀疑安装目的(升级?)。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏