如何安装Pylint,克服错误

时间:2019-07-09 03:54:46

标签: python pip pylint

我正在迈入Python的第一步,其中一部分就是将其全部安装并在MacBook Pro上运行。我一直在努力安装pylint,因为Visual Studio Code不断通知我。

虽然我无法告诉您原因,但我了解到操作皮棉机是有益的,但我决心从一开始就做好准备。在编码方面,我是一个菜鸟。请保持友善。

我在github上找到了此链接,尽管响应超出了我本人:https://github.com/pypa/pip/issues/5465

侧面问题-pip和pip3之间有区别吗?我的bin文件夹中似乎都有它们。谢谢:)

我尝试过的事情

我安装了python 2.7(使用mac进行系统安装)和python 3.7(同种安装)。我已经更新了pip(为此我必须使用'pip3 install --update pip')

我尝试过: 点安装pylint pip3安装pylint sudo pip安装pylint

当我尝试sudo时(不建议以后阅读),我还会收到以下警告:

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.

这是安装的完整输出。我认为它正在使用缓存文件,就像我尝试过几次一样,这是第一次下载它们。

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 个答案:

答案 0 :(得分:0)

解决方案是运行“ Install Certificates.command” shell命令。

可在Applications \ Python 3.7 \

中找到

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