Visual Studio Code安装python扩展pylint失败

时间:2018-12-19 12:07:34

标签: python visual-studio-code attributeerror pylint

今天,我使用vscode编辑器python代码,该vscode提醒安装pylint。因此,我安装了python externsion,同时在终端中安装了oylint,请使用cmd python -m pip install -U pylint --user。 但是终端报告了

的信息
    Traceback (most recent call last):
  File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\__init__.py", line 26, in <module>
    from pip.utils import get_installed_distributions, get_prog
  File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\utils\__init__.py", line 27, in <module>
    from pip._vendor import pkg_resources
  File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 74, in <module>
    __import__('pip._vendor.packaging.requirements')
  File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\_vendor\packaging\requirements.py", line 9, in <module>
    from pip._vendor.pyparsing import (
  File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\_vendor\pyparsing.py", line 4720, in <module>
    _reBracketExpr = Literal("[") + Optional("^").setResultsName("negate") + Group( OneOrMore( _charRange | _singleChar ) ).setResultsName("body") + "]"
  File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\_vendor\pyparsing.py", line 1201, in setResultsName
    newself = self.copy()
  File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\_vendor\pyparsing.py", line 1160, in copy
    cpy = copy.copy( self )
AttributeError: module 'copy' has no attribute 'copy'

目前我找不到解决该问题的有效措施,所以在这里我可以找到帮助,谢谢!

1 个答案:

答案 0 :(得分:0)

您的工作区中可能有一个名为copy的模块。重命名该名称,这样它就不会掩盖Python的stdlib中的内置copy模块,并且应该可以让pip正常运行。