Windows 和 python 3.2 的 Pylint 安装问题

2024-05-15

当我尝试使用 pip 在 Windows 上安装 pylint 时,我遇到了这个问题,我真的不知道它来自哪里。

    C:\Python33\Scripts>pip.exe install pylint
    Downloading/unpacking pylint

      Getting page https://pypi.python.org/simple/pylint/
      URLs to search for versions for pylint:
      * https://pypi.python.org/simple/pylint/
      Analyzing links from page https://pypi.python.org/simple/pylint/

    ...

    byte-compiling C:\Python33\Lib\site-packages\pylint\utils.py to utils.cpython-33.pyc

    byte-compiling C:\Python33\Lib\site-packages\pylint\__init__.py to __init__.cpython-33.pyc

    byte-compiling C:\Python33\Lib\site-packages\pylint\__pkginfo__.py to __pkginfo__.cpython-33.pyc

    error: The system cannot find the file specified


    running 2to3 on C:\Python33\Lib\site-packages\pylint\test

    ----------------------------------------

    Cleaning up...

      Removing temporary dir c:\windows\temp\pip_build_abrow198...
    Command C:\Python33\python.exe -c "import setuptools;__file__='c:\\windows\\temp\\pip_build_abrow198\\pylint\\setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\windows\temp\pip-cq0pam-record\install-record.txt --single-version-externally-managed failed with error code 1 in c:\windows\temp\pip_build_abrow198\pylint

看起来 Pylint 及其依赖项 logilab-common 的设置脚本中存在错误。我在构建时遇到错误pip install pylint or python setup.py install.

该错误通常如下所示,并且发生在.pyc文件是字节编译的:

error: The system cannot find the file specified
running 2to3 on C:\Python33\Lib\site-packages\pylint\test

只需确保2to3.py在 PATH 上可用似乎还不够; 2to3 本身将运行,但 Pylint 不会安装。

我只是花了一些时间尝试让它发挥作用,并发现了两个有希望的建议:

第一个选项,创建一个自定义 bat 文件,以便 2to3 有效地位于您的 PATH 上(请参阅所以线程 https://stackoverflow.com/questions/19787849/python-easy-install-pylint-error-the-system-cannot-find-the-file-specified, 问题跟踪器 https://bitbucket.org/logilab/pylint/issue/51/building-pylint-windows-installer-for)。我设法得到2to3在 PowerShell 和 CMD 中作为裸命令运行,但无法安装 Pylint。其他人可能会更幸运。

第二个选项,安装不同版本的 Pylint 和 logilab-common,它们通过 distutils 调用 2to3,而不是在命令行上(请参阅未合并的拉取请求 https://bitbucket.org/logilab/logilab-common/pull-request/2/setuppy-dont-call-2to3-directly/diff)。这立即对我有用。

自 10 月份以来,BitBucket 将该拉取请求列为“开放”。我不知道它什么时候会被合并,也不知道更改之后多久会在 PyPI 上生效。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Windows 和 python 3.2 的 Pylint 安装问题 的相关文章

随机推荐