How to install Pylint, overcoming errors

柔情痞子 提交于 2021-02-10 17:53:38

问题


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.

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.

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

Side question - is there a difference between pip and pip3? I seem to have both in my bin folder. Thanks :)

What I've Tried

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')

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

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/

回答1:


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

This is found in Applications\Python 3.7\

Like I said, total noob.



来源:https://stackoverflow.com/questions/56945117/how-to-install-pylint-overcoming-errors

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!