vscode 安装pylint失败

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

  ERROR: Command errored out with exit status 1:
     command: 'D:\work\python\Programs\Python\Python39\python.exe' 'D:\work\python\Programs\Python\Python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\xx\AppData\Local\Temp\tmplrfbgazl'
         cwd: C:\Users\xx\AppData\Local\Temp\pip-install-0r8mkquq\lazy-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:\work\python\Programs\Python\Python39\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 280, in <module>
        main()
      File "D:\work\python\Programs\Python\Python39\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 263, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "D:\work\python\Programs\Python\Python39\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 133, in prepare_metadata_for_build_wheel
        return hook(metadata_directory, config_settings)
      File "D:\work\python\Programs\Python\Python39\lib\site-packages\setuptools\build_meta.py", line 157, in prepare_metadata_for_build_wheel
        self.run_setup()
      File "D:\work\python\Programs\Python\Python39\lib\site-packages\setuptools\build_meta.py", line 248, in run_setup
        super(_BuildMetaLegacyBackend,
      File "D:\work\python\Programs\Python\Python39\lib\site-packages\setuptools\build_meta.py", line 142, in run_setup
        exec(compile(code, __file__, 'exec'), locals())
      File "setup.py", line 61, in <module>
        setup(
      File "D:\work\python\Programs\Python\Python39\lib\site-packages\setuptools\__init__.py", line 164, in setup
        _install_setup_requires(attrs)
      File "D:\work\python\Programs\Python\Python39\lib\site-packages\setuptools\__init__.py", line 159, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "D:\work\python\Programs\Python\Python39\lib\site-packages\setuptools\dist.py", line 699, in fetch_build_eggs
        resolved_dists = pkg_resources.working_set.resolve(
      File "D:\work\python\Programs\Python\Python39\lib\site-packages\pkg_resources\__init__.py", line 779, in resolve
        dist = best[req.key] = env.best_match(
      File "D:\work\python\Programs\Python\Python39\lib\site-packages\pkg_resources\__init__.py", line 1064, in best_match
        return self.obtain(req, installer)
      File "D:\work\python\Programs\Python\Python39\lib\site-packages\pkg_resources\__init__.py", line 1076, in obtain
        return installer(requirement)
      File "D:\work\python\Programs\Python\Python39\lib\site-packages\setuptools\dist.py", line 758, in fetch_build_egg
        return fetch_build_egg(self, req)
      File "D:\work\python\Programs\Python\Python39\lib\site-packages\setuptools\installer.py", line 133, in fetch_build_egg
        wheel.install_as_egg(dist_location)
      File "D:\work\python\Programs\Python\Python39\lib\site-packages\setuptools\wheel.py", line 99, in install_as_egg
        self._install_as_egg(destination_eggdir, zf)
      File "D:\work\python\Programs\Python\Python39\lib\site-packages\setuptools\wheel.py", line 107, in _install_as_egg
        self._convert_metadata(zf, destination_eggdir, dist_info, egg_info)
      File "D:\work\python\Programs\Python\Python39\lib\site-packages\setuptools\wheel.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:\work\python\Programs\Python\Python39\python.exe' 'D:\work\python\Programs\Python\Python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\xx\AppData\Local\Temp\tmplrfbgazl' Check the logs for full command output.

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

D:\work\python\Programs\Python\Python39\python.exe -m pip install pylint
PS D:\work\python\learn\hello> D:\work\python\Programs\Python\Python39\python.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:\users\xx\appdata\roaming\python\python39\site-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:\users\xx\appdata\roaming\python\python39\site-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:\users\xx\appdata\local\pip\cache\wheels\98\23\68\efe259aaca055e93b08e74fbe512819c69a2155c11ba3c0f10
  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:\users\xx\appdata\local\pip\cache\wheels\41\20\07\2a3e02cdfc8b442404202f6ef99ff1b1c16b73910968a46f2f
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:\work\python\Programs\Python\Python39\Scripts' 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:\work\python\Programs\Python\Python39\Scripts' 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:\work\python\Programs\Python\Python39\Scripts,警告也会消失。

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



posted @ 2020-11-13 02:53  暗夜影  阅读(1260)  评论(0编辑  收藏  举报