我一直在尝试安装一些软件包。我使用python 3.6但是现在我正在尝试python 3.4。错误:

时间:2017-08-28 09:01:43

标签: python pip

C:\Python34>py -3.4 -m pip install logging
Collecting logging
  Using cached logging-0.4.9.6.tar.gz
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info\logging.egg-info
    writing top-level names to pip-egg-info\logging.egg-info\top_level.txt
    writing dependency_links to pip-egg-info\logging.egg-info\dependency_links.txt
    writing pip-egg-info\logging.egg-info\PKG-INFO
    writing manifest file 'pip-egg-info\logging.egg-info\SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\admin\AppData\Local\Temp\pip-build-n2qiu66i\logging\setup.py", line 13, in <module>
    packages = ["logging"],
  File "C:\Python34\lib\distutils\core.py", line 149, in setup
    dist.run_commands()
  File "C:\Python34\lib\distutils\dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "C:\Python34\lib\site-packages\setuptools\command\egg_info.py", line 163, in run
    self.find_sources()
  File "C:\Python34\lib\site-packages\setuptools\command\egg_info.py", line 186, in find_sources
    mm.run()
  File "C:\Python34\lib\site-packages\setuptools\command\egg_info.py", line 246, in run
    self.add_defaults()
  File "C:\Python34\lib\site-packages\setuptools\command\egg_info.py", line 282, in add_defaults
    sdist.add_defaults(self)
  File "C:\Python34\lib\site-packages\setuptools\command\sdist.py", line 161, in add_defaults
    build_py = self.get_finalized_command('build_py')
  File "C:\Python34\lib\distutils\cmd.py", line 298, in get_finalized_command
    cmd_obj = self.distribution.get_command_obj(command, create)
  File "C:\Python34\lib\distutils\dist.py", line 846, in get_command_obj
    klass = self.get_command_class(command)
  File "C:\Python34\lib\site-packages\setuptools\dist.py", line 363, in get_command_class
    self.cmdclass[command] = cmdclass = ep.load()
  File "C:\Python34\lib\site-packages\pkg_resources.py", line 2029, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "C:\Python34\lib\site-packages\setuptools\command\build_py.py", line 10, in <module>
    from setuptools.lib2to3_ex import Mixin2to3
  File "C:\Python34\lib\site-packages\setuptools\lib2to3_ex.py", line 12, in <module>
    from lib2to3.refactor import RefactoringTool, get_fixers_from_package
  File "C:\Python34\lib\lib2to3\refactor.py", line 19, in <module>
    import logging
  File "C:\Users\admin\AppData\Local\Temp\pip-build-n2qiu66i\logging\logging\__init__.py", line 618
    raise NotImplementedError, 'emit must be implemented '\
                             ^
SyntaxError: invalid syntax

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\admin\AppData\Local\Temp\pip-build-n2qiu66i\logging\

2 个答案:

答案 0 :(得分:3)

logging现在是Python标准库的一部分,因此您无需通过pip install进行安装。

您在PyPI上找到的logging模块确实已过时,而且与Python3不兼容。

(其最新版本于2005年3月2日发布,根据其README文件)

因此,请停止尝试安装旧版logging。只需将标准库中的新logging模块视为理所当然。

答案 1 :(得分:0)

确保您的setup.py没有将“ logging”指定为依赖项包。