当我尝试用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
或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有效地在你的路径(见SO线程 , 问题跟踪 )。 我设法让2to3
在PowerShell和CMD中作为一个简单的命令运行,但是无法安装Pylint。 其他人可能会有更多的运气与此。
第二个选项,安装不同版本的Pylint和logilab-common,通过distutils调用2to3而不是在命令行上(参见未合并的请求 )。 这立即为我工作。
BitBucket将自10月起将请求列为“打开”。 我不知道什么时候可以合并,或者在PyPI上可以存活多长时间。