【问题标题】:Visual Studio Code install python extension pylint failedVisual Studio Code 安装 python 扩展 pylint 失败
【发布时间】:2018-12-19 12:07:34
【问题描述】:

今天用vscode编辑python代码,vscode提醒安装pylint。所以我安装了python externsion,同时我在终端安装了oylint use 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'

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

【问题讨论】:

  • 你的当前工作目录中是否有名为copy.py的文件?

标签: python visual-studio-code attributeerror pylint


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2021-05-09
    • 1970-01-01
    • 1970-01-01
    • 2023-03-19
    • 2016-09-01
    • 1970-01-01
    • 2019-03-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多