如何安装 Pylint,克服错误 [英] How to install Pylint, overcoming errors

查看:79
本文介绍了如何安装 Pylint,克服错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在迈出使用 Python 的第一步,其中一部分是在我的 MacBook Pro 上启动并运行它.我正在努力安装 pylint,因为 Visual Studio Code 不断通知我.

I'm taking my first steps into Python, and part of that is getting it all up and running on my MacBook Pro. I'm struggling to get pylint installed, as Visual Studio Code keeps informing me.

我被告知使用 linter 操作是有益的,虽然我无法告诉您原因,但我决心从一开始就正确设置.在编码方面,我是一个完整的菜鸟.请客气点.

I am informed that have a linter operational is beneficial, although I couldn't tell you why, but am determined to get things set up right from the start. I am a complete noob when it comes to coding. Please be nice.

我在 github 上找到了这个链接,虽然回复有点超出我的范围:https://github.com/pypa/pip/issues/5465

I've found this link on github, although the responses are somewhat beyond me: https://github.com/pypa/pip/issues/5465

附带问题 - pip 和 pip3 之间有区别吗?我的 bin 文件夹中似乎都有.谢谢:)

我的尝试

我安装了 python 2.7(系统安装 mac)和 python 3.7(hombrew 安装).我已经更新了 pip(为此我必须使用pip3 install --update pip")

I have python 2.7 (system install with mac) and python 3.7 (hombrew installation) installed. I've updated pip (for which I had to use 'pip3 install --update pip')

我试过:pip安装pylintpip3 安装 pylint须藤 pip 安装 pylint

I've tried: pip install pylint pip3 install pylint sudo pip install pylint

当我尝试 sudo 时(我不建议阅读此内容)我也收到以下警告:

When I try sudo (Which I've since read is not advisable) I also get the following warning:

WARNING: The directory '/Users/maxwartelle/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/Users/maxwartelle/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

这是安装的完整输出.我认为它正在使用缓存文件,因为我已经尝试了几次,这是第一次下载它们.

Here's the full output for the install. I think it's using cached files as I had tried it a couple of times, the first time it downloaded them.

Maxs-MacBook-Pro:Exercise Files maxwartelle$ pip install pylint
Collecting pylint
  Using cached https://files.pythonhosted.org/packages/60/c2/b3f73f4ac008bef6e75bca4992f3963b3f85942e0277237721ef1c151f0d/pylint-2.3.1-py3-none-any.whl
Collecting isort<5,>=4.2.5 (from pylint)
  Using cached https://files.pythonhosted.org/packages/e5/b0/c121fd1fa3419ea9bfd55c7f9c4fedfec5143208d8c7ad3ce3db6c623c21/isort-4.3.21-py2.py3-none-any.whl
Collecting mccabe<0.7,>=0.6 (from pylint)
  Using cached https://files.pythonhosted.org/packages/87/89/479dc97e18549e21354893e4ee4ef36db1d237534982482c3681ee6e7b57/mccabe-0.6.1-py2.py3-none-any.whl
Collecting astroid<3,>=2.2.0 (from pylint)
  Using cached https://files.pythonhosted.org/packages/d5/ad/7221a62a2dbce5c3b8c57fd18e1052c7331adc19b3f27f1561aa6e620db2/astroid-2.2.5-py3-none-any.whl
Collecting lazy-object-proxy (from astroid<3,>=2.2.0->pylint)
  Using cached https://files.pythonhosted.org/packages/ad/57/a36f682668ffc453e86ddfb5a2a49848edcb7bd04a210a5a8692a48ed9c4/lazy-object-proxy-1.4.1.tar.gz
    ERROR: Complete output from command python setup.py egg_info:
    ERROR: Download error on https://pypi.org/simple/setuptools_scm/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076) -- Some packages may not be found!
    Download error on https://pypi.org/simple/setuptools-scm/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076) -- Some packages may not be found!
    Couldn't find index page for 'setuptools_scm' (maybe misspelled?)
    Download error on https://pypi.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076) -- Some packages may not be found!
    No local packages or working download links found for setuptools_scm>=3.3.1
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/_0/sncbcbsn5kd_03fhfjnr4czh0000gn/T/pip-install-mbw14gwe/lazy-object-proxy/setup.py", line 129, in <module>
        for root, _, _ in os.walk('src')
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/__init__.py", line 144, in setup
        _install_setup_requires(attrs)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/__init__.py", line 139, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/dist.py", line 717, in fetch_build_eggs
        replace_conflicting=True,
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 782, in resolve
        replace_conflicting=replace_conflicting
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1065, in best_match
        return self.obtain(req, installer)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1077, in obtain
        return installer(requirement)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/dist.py", line 784, in fetch_build_egg
        return cmd.easy_install(req)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 673, in easy_install
        raise DistutilsError(msg)
    distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('setuptools_scm>=3.3.1')
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/_0/sncbcbsn5kd_03fhfjnr4czh0000gn/T/pip-install-mbw14gwe/lazy-object-proxy/

推荐答案

解决方案是运行Install Certificates.command"shell 命令.

The solution was to run the "Install Certificates.command" shell command.

这可以在 Applications\Python 3.7\ 中找到

This is found in Applications\Python 3.7\

就像我说的,完全是菜鸟.

Like I said, total noob.

这篇关于如何安装 Pylint,克服错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆