无法在 Python2.7 中安装 pylint,甚至在本地 setup.py 中安装时也会出现不匹配的错误

Couldn't install pylint in Python2.7 and get not matched errors even install with the local setup.py

由于开发环境受限我不得不在Windows10.
中使用Python2.7 所以我选择安装 pylint 作为我在管理员模式下使用的 linter。

pip install "pylint<2.0.0"

但只输出如下:

WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/pylint/

这条消息重复多次然后给出这样的输出:

ERROR: Could not find a version that satisfies the requirement pylint<2.0.0 (from versions: none) ERROR: No matching distribution found for pylint<2.0.0

所以我在PyPI下载了一个1.9.3的版本。
并尝试在管理员模式下使用 setup.py 安装它,如下所示:

python setup.py install

但也遇到了和以前一样的问题:

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/pylint/

WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/pylint/

WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/pylint/

WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/pylint/

WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/pylint/

ERROR: Could not find a version that satisfies the requirement pylint==1.9.3 (from versions: none)

ERROR: No matching distribution found for pylint==1.9.3

我也试过老版本,比如1.8.41.7.4等等

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/pytest-runner/

WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/pytest-runner/

WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/pytest-runner/

WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/pytest-runner/

WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/pytest-runner/

ERROR: Could not find a version that satisfies the requirement pytest-runner (from versions: none)

ERROR: No matching distribution found for pytest-runner

Traceback (most recent call last):

File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools\installer.py", line 128, in fetch_build_egg

subprocess.check_call(cmd)

File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 363, in check_call

raise CalledProcessError(retcode, cmd)

subprocess.CalledProcessError: Command '['C:\ProgramData\Anaconda3\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\Users\EU\AppData\Local\Temp\tmpyjj78l40', '--quiet', 'pytest-runner']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "setup.py", line 178, in

install()

File "setup.py", line 175, in install

**kwargs)

File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools__init__.py", line 143, in setup

_install_setup_requires(attrs)

File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools__init__.py", line 138, in _install_setup_requires

dist.fetch_build_eggs(dist.setup_requires)

File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools\dist.py", line 721, in fetch_build_eggs

replace_conflicting=True,

File "C:\ProgramData\Anaconda3\lib\site-packages\pkg_resources__init__.py", line 783, in resolve

replace_conflicting=replace_conflicting

File "C:\ProgramData\Anaconda3\lib\site-packages\pkg_resources__init__.py", line 1066, in best_match

return self.obtain(req, installer)

File "C:\ProgramData\Anaconda3\lib\site-packages\pkg_resources__init__.py", line 1078, in obtain

return installer(requirement)

File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools\dist.py", line 777, in fetch_build_egg

return fetch_build_egg(self, req)

File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools\installer.py", line 130, in fetch_build_egg

raise DistutilsError(str(e))

distutils.errors.DistutilsError: Command '['C:\ProgramData\Anaconda3\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\Users\EU\AppData\Local\Temp\tmpyjj78l40', '--quiet', 'pytest-runner']' returned non-zero exit status 1.

但是这里还有其他问题,困扰了我一整天。

所以有人可以帮助我或给我一些提示吗?
提前致谢。

首先,你应该尽可能避免Python2.7,因为它是no longer supported.

您可能位于阻止这些连接的防火墙后面。如果那是你的问题,请尝试 this.