vscode 安装pylint失败

pylint为python的代码分析工具,如未安装一直在右下角弹出提示安装,点击安装时又会出现乱七八糟的错误,网上查找后大多数都是说是编码错误。

  ERROR: Command errored out with exit status 1:
     command: 'D:workpythonProgramsPythonPython39python.exe' 'D:workpythonProgramsPythonPython39libsite-packagespip\_vendorpep517\_in_process.py' prepare_metadata_for_build_wheel 'C:UsersxxAppDataLocalTemp	mplrfbgazl'
         cwd: C:UsersxxAppDataLocalTemppip-install-0r8mkquqlazy-object-proxy
    Complete output (42 lines):
    Error in sitecustomize; set PYTHONVERBOSE for traceback:
    SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xd5 in position 0: invalid continuation byte (sitecustomize.py, line 21)
    Error in sitecustomize; set PYTHONVERBOSE for traceback:
    SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xd5 in position 0: invalid continuation byte (sitecustomize.py, line 21)
    Traceback (most recent call last):
      File "D:workpythonProgramsPythonPython39libsite-packagespip\_vendorpep517\_in_process.py", line 280, in <module>
        main()
      File "D:workpythonProgramsPythonPython39libsite-packagespip\_vendorpep517\_in_process.py", line 263, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "D:workpythonProgramsPythonPython39libsite-packagespip\_vendorpep517\_in_process.py", line 133, in prepare_metadata_for_build_wheel
        return hook(metadata_directory, config_settings)
      File "D:workpythonProgramsPythonPython39libsite-packagessetuptoolsuild_meta.py", line 157, in prepare_metadata_for_build_wheel
        self.run_setup()
      File "D:workpythonProgramsPythonPython39libsite-packagessetuptoolsuild_meta.py", line 248, in run_setup
        super(_BuildMetaLegacyBackend,
      File "D:workpythonProgramsPythonPython39libsite-packagessetuptoolsuild_meta.py", line 142, in run_setup
        exec(compile(code, __file__, 'exec'), locals())
      File "setup.py", line 61, in <module>
        setup(
      File "D:workpythonProgramsPythonPython39libsite-packagessetuptools\__init__.py", line 164, in setup
        _install_setup_requires(attrs)
      File "D:workpythonProgramsPythonPython39libsite-packagessetuptools\__init__.py", line 159, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "D:workpythonProgramsPythonPython39libsite-packagessetuptoolsdist.py", line 699, in fetch_build_eggs
        resolved_dists = pkg_resources.working_set.resolve(
      File "D:workpythonProgramsPythonPython39libsite-packagespkg_resources\__init__.py", line 779, in resolve
        dist = best[req.key] = env.best_match(
      File "D:workpythonProgramsPythonPython39libsite-packagespkg_resources\__init__.py", line 1064, in best_match
        return self.obtain(req, installer)
      File "D:workpythonProgramsPythonPython39libsite-packagespkg_resources\__init__.py", line 1076, in obtain
        return installer(requirement)
      File "D:workpythonProgramsPythonPython39libsite-packagessetuptoolsdist.py", line 758, in fetch_build_egg
        return fetch_build_egg(self, req)
      File "D:workpythonProgramsPythonPython39libsite-packagessetuptoolsinstaller.py", line 133, in fetch_build_egg
        wheel.install_as_egg(dist_location)
      File "D:workpythonProgramsPythonPython39libsite-packagessetuptoolswheel.py", line 99, in install_as_egg
        self._install_as_egg(destination_eggdir, zf)
      File "D:workpythonProgramsPythonPython39libsite-packagessetuptoolswheel.py", line 107, in _install_as_egg
        self._convert_metadata(zf, destination_eggdir, dist_info, egg_info)
      File "D:workpythonProgramsPythonPython39libsite-packagessetuptoolswheel.py", line 152, in _convert_metadata
        os.rename(dist_info, egg_info)
    PermissionError: [WinError 5] 拒绝访问。: 'C:\Users\xx\AppData\Local\Temp\pip-install-0r8mkquq\lazy-object-proxy\.eggs\setuptools_scm-4.1.2-py3.9.egg\setuptools_scm-4.1.2.dist-info' -> 'C:\Users\xx\AppData\Local\Temp\pip-install-0r8mkquq\lazy-object-proxy\.eggs\setuptools_scm-4.1.2-py3.9.egg\EGG-INFO'
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'D:workpythonProgramsPythonPython39python.exe' 'D:workpythonProgramsPythonPython39libsite-packagespip\_vendorpep517\_in_process.py' prepare_metadata_for_build_wheel 'C:UsersxxAppDataLocalTemp	mplrfbgazl' Check the logs for full command output.

在安装wheel后其实通过手动执行pip命令安装pylint即可安装成功

D:workpythonProgramsPythonPython39python.exe -m pip install pylint
PS D:workpythonlearnhello> D:workpythonProgramsPythonPython39python.exe -m pip install pylint
Collecting pylint
  Using cached pylint-2.6.0-py3-none-any.whl (325 kB)
Requirement already satisfied: colorama; sys_platform == "win32" in c:usersxxappdata
oamingpythonpython39site-packages (from pylint) (0.4.4)
Collecting isort<6,>=4.2.5
  Using cached isort-5.6.4-py3-none-any.whl (98 kB)
Collecting mccabe<0.7,>=0.6
  Using cached mccabe-0.6.1-py2.py3-none-any.whl (8.6 kB)
Collecting toml>=0.7.1
  Using cached toml-0.10.2-py2.py3-none-any.whl (16 kB)
Collecting astroid<=2.5,>=2.4.0
  Using cached astroid-2.4.2-py3-none-any.whl (213 kB)
Requirement already satisfied: six~=1.12 in c:usersxxappdata
oamingpythonpython39site-packages (from astroid<=2.5,>=2.4.0->pylint) (1.15.0)
Collecting wrapt~=1.11
  Using cached wrapt-1.12.1.tar.gz (27 kB)
  Using cached lazy-object-proxy-1.4.3.tar.gz (34 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: wrapt, lazy-object-proxy
  Building wheel for wrapt (setup.py) ... done
  Created wheel for wrapt: filename=wrapt-1.12.1-py3-none-any.whl size=19558 sha256=a89b30b417a76a3c1cff5e7fc5fcc978875cd130560c8eb9ca5c9896cff4d16f
  Stored in directory: c:usersxxappdatalocalpipcachewheels982368efe259aaca055e93b08e74fbe512819c69a2155c11ba3c0f10
  Building wheel for lazy-object-proxy (PEP 517) ... done
  Created wheel for lazy-object-proxy: filename=lazy_object_proxy-1.4.3-cp39-cp39-win_amd64.whl size=10002 sha256=95e664d48adddeed7d2498a4430f5ea04eae1ef1cd643ec2f7a0c747ba16076d
  Stored in directory: c:usersxxappdatalocalpipcachewheels412072a3e02cdfc8b442404202f6ef99ff1b1c16b73910968a46f2f
Successfully built wrapt lazy-object-proxy
Installing collected packages: isort, mccabe, toml, wrapt, lazy-object-proxy, astroid, pylint
  WARNING: The script isort.exe is installed in 'D:workpythonProgramsPythonPython39Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts epylint.exe, pylint.exe, pyreverse.exe and symilar.exe are installed in 'D:workpythonProgramsPythonPython39Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed astroid-2.4.2 isort-5.6.4 lazy-object-proxy-1.4.3 mccabe-0.6.1 pylint-2.6.0 toml-0.10.2 wrapt-1.12.1

在系统的环境变量path中设置D:workpythonProgramsPythonPython39Scripts,警告也会消失。

安装成功后,pylint会对拼写、语法错误进行提示。



原文地址:https://www.cnblogs.com/Pan-Z/p/13967311.html