lsp-bridge必须使用pyright吗?我在init.el中改成 python-lsp-server 'pylsp 打开Python文件依然是提示启动pyright并失败。
我这里提示pyright、python-lsp-server、node 和npm都已经安装了,但直接运行pyright还是会出现和lsp-bridge一样的错误,请问是什么原因?要怎么处理?谢谢。
subprocess.CalledProcessError: Command '['e:\\lxs\\anaconda\\python.exe', '-m', 'nodeenv', 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pyright-python.Administrator\\env']' returned non-zero exit status 2.
完整的pyright::stderr信息如下:
* Environment already exists: C:\Users\ADMINI~1\AppData\Local\Temp\pyright-python.Administrator\env
Traceback (most recent call last):
File "e:\lxs\anaconda\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "e:\lxs\anaconda\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "e:\lxs\anaconda\Scripts\pyright-langserver.exe\__main__.py", line 7, in <module>
File "e:\lxs\anaconda\lib\site-packages\pyright\langserver.py", line 57, in entrypoint
sys.exit(main(*sys.argv[1:]))
File "e:\lxs\anaconda\lib\site-packages\pyright\langserver.py", line 26, in main
return run(*args, **kwargs).returncode
File "e:\lxs\anaconda\lib\site-packages\pyright\langserver.py", line 37, in run
version = node.latest('pyright')
File "e:\lxs\anaconda\lib\site-packages\pyright\node.py", line 133, in latest
proc = run(
File "e:\lxs\anaconda\lib\site-packages\pyright\node.py", line 86, in run
binary = _ensure_available(target)
File "e:\lxs\anaconda\lib\site-packages\pyright\node.py", line 34, in _ensure_available
return Binary(path=_ensure_node_env(target), strategy=Strategy.NODEENV)
File "e:\lxs\anaconda\lib\site-packages\pyright\node.py", line 52, in _ensure_node_env
_install_node_env()
File "e:\lxs\anaconda\lib\site-packages\pyright\node.py", line 79, in _install_node_env
subprocess.run(args, check=True)
File "e:\lxs\anaconda\lib\subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['e:\\lxs\\anaconda\\python.exe', '-m', 'nodeenv', 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pyright-python.Administrator\\env']' returned non-zero exit status 2.
Process pyright stderr finished
* Environment already exists: C:\Users\ADMINI~1\AppData\Local\Temp\pyright-python.Administrator\env
Traceback (most recent call last):
File "e:\lxs\anaconda\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "e:\lxs\anaconda\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "e:\lxs\anaconda\Scripts\pyright-langserver.exe\__main__.py", line 7, in <module>
File "e:\lxs\anaconda\lib\site-packages\pyright\langserver.py", line 57, in entrypoint
sys.exit(main(*sys.argv[1:]))
File "e:\lxs\anaconda\lib\site-packages\pyright\langserver.py", line 26, in main
return run(*args, **kwargs).returncode
File "e:\lxs\anaconda\lib\site-packages\pyright\langserver.py", line 37, in run
version = node.latest('pyright')
File "e:\lxs\anaconda\lib\site-packages\pyright\node.py", line 133, in latest
proc = run(
File "e:\lxs\anaconda\lib\site-packages\pyright\node.py", line 86, in run
binary = _ensure_available(target)
File "e:\lxs\anaconda\lib\site-packages\pyright\node.py", line 34, in _ensure_available
return Binary(path=_ensure_node_env(target), strategy=Strategy.NODEENV)
File "e:\lxs\anaconda\lib\site-packages\pyright\node.py", line 52, in _ensure_node_env
_install_node_env()
File "e:\lxs\anaconda\lib\site-packages\pyright\node.py", line 79, in _install_node_env
subprocess.run(args, check=True)
File "e:\lxs\anaconda\lib\subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['e:\\lxs\\anaconda\\python.exe', '-m', 'nodeenv', 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pyright-python.Administrator\\env']' returned non-zero exit status 2.
Process pyright stderr finished
安装信息如下:
Microsoft Windows [版本 10.0.17763.1098]
(c) 2018 Microsoft Corporation。保留所有权利。
e:\lxs>echo %PATH%
echo %PATH%
e:\lxs\Anaconda3;e:\lxs\Anaconda3\Library\mingw-w64\bin;e:\lxs\Anaconda3\Library\usr\bin;e:\lxs\Anaconda3\Library\bin;e:\lxs\Anaconda3\Scripts;c:\Windows\system32;c:\Windows;c:\Windows\System32\Wbem;c:\Windows\System32\WindowsPowerShell\v1.0;c:\Windows\System32\OpenSSH;c:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;c:\Program Files\Intel\Intel(R) Management Engine Components\DAL;c:\Program Files\Intel\WiFi\bin;c:\Program Files\Common Files\Intel\WirelessCommon;d:\Program Files\Gow\bin;e:\lxs\Git\cmd;c:\Users\Administrator\scoop\shims;e:\lxs\texlive\2020\bin\win32;c:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;d:\Program Files\GNU Octave\Octave-6.2.0;e:\lxs\linux\wsl-terminal;d:\Program Files\Tesseract-OCR;;d:\Program Files\R\R-4.1.2\bin\x64;d:\Program Files\R\R-4.1.2\bin;d:\Program Files\ripgrep;e:\lxs\anaconda;e:\lxs\anaconda\Library\mingw-w64\bin;e:\lxs\anaconda\Library\usr\bin;e:\lxs\anaconda\Library\bin;e:\lxs\anaconda\Scripts;d:\Program Files\Inkscape\bin;d:\Program Files\Microsoft VS Code\bin;d:\Program Files\poppler-0.68.0\bin;d:\Tencent\QQGameTempest\Hall.57734;e:\lxs\emacs-28.1\libexec\emacs\28.1\x86_64-w64-mingw32
e:\lxs>where pyright
where pyright
e:\lxs\anaconda\Scripts\pyright.exe
e:\lxs>ls e:\lxs\anaconda\Scripts\pyright*
ls e:\lxs\anaconda\Scripts\pyright*
e:\lxs\anaconda\Scripts\pyright-langserver.exe
e:\lxs\anaconda\Scripts\pyright-python-langserver.exe
e:\lxs\anaconda\Scripts\pyright-python.exe
e:\lxs\anaconda\Scripts\pyright.exe
e:\lxs\anaconda\Scripts\pyright.exe.deleteme
e:\lxs>pip install node npm
pip install node npm
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: node in .\anaconda\lib\site-packages (1.0)
Requirement already satisfied: npm in .\anaconda\lib\site-packages (0.1.1)
Requirement already satisfied: zope.deprecation in .\anaconda\lib\site-packages (from node) (4.4.0)
Requirement already satisfied: odict>=1.8.0 in .\anaconda\lib\site-packages (from node) (1.9.0)
Requirement already satisfied: zope.lifecycleevent in .\anaconda\lib\site-packages (from node) (4.4)
Requirement already satisfied: zope.deferredimport in .\anaconda\lib\site-packages (from node) (4.4)
Requirement already satisfied: zope.component in .\anaconda\lib\site-packages (from node) (5.0.1)
Requirement already satisfied: setuptools in .\anaconda\lib\site-packages (from node) (52.0.0.post20210125)
Requirement already satisfied: plumber>=1.5 in .\anaconda\lib\site-packages (from node) (1.7)
Requirement already satisfied: optional-django==0.1.0 in .\anaconda\lib\site-packages (from npm) (0.1.0)
Requirement already satisfied: zope.event in .\anaconda\lib\site-packages (from zope.component->node) (4.5.0)
Requirement already satisfied: zope.interface>=5.3.0a1 in .\anaconda\lib\site-packages (from zope.component->node) (5.3.0)
Requirement already satisfied: zope.hookable>=4.2.0 in .\anaconda\lib\site-packages (from zope.component->node) (5.1.0)
Requirement already satisfied: zope.proxy in .\anaconda\lib\site-packages (from zope.deferredimport->node) (4.5.0)
e:\lxs>pyright
pyright
* Environment already exists: C:\Users\ADMINI~1\AppData\Local\Temp\pyright-python.Administrator\env
Traceback (most recent call last):
File "e:\lxs\anaconda\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "e:\lxs\anaconda\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "e:\lxs\anaconda\Scripts\pyright.exe\__main__.py", line 7, in <module>
File "e:\lxs\anaconda\lib\site-packages\pyright\cli.py", line 72, in entrypoint
sys.exit(main(sys.argv[1:]))
File "e:\lxs\anaconda\lib\site-packages\pyright\cli.py", line 20, in main
return run(*args, **kwargs).returncode
File "e:\lxs\anaconda\lib\site-packages\pyright\cli.py", line 36, in run
npx = node.version('npx')
File "e:\lxs\anaconda\lib\site-packages\pyright\node.py", line 116, in version
proc = run(target, '--version', stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
File "e:\lxs\anaconda\lib\site-packages\pyright\node.py", line 86, in run
binary = _ensure_available(target)
File "e:\lxs\anaconda\lib\site-packages\pyright\node.py", line 34, in _ensure_available
return Binary(path=_ensure_node_env(target), strategy=Strategy.NODEENV)
File "e:\lxs\anaconda\lib\site-packages\pyright\node.py", line 52, in _ensure_node_env
_install_node_env()
File "e:\lxs\anaconda\lib\site-packages\pyright\node.py", line 79, in _install_node_env
subprocess.run(args, check=True)
File "e:\lxs\anaconda\lib\subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['e:\\lxs\\anaconda\\python.exe', '-m', 'nodeenv', 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pyright-python.Administrator\\env']' returned non-zero exit status 2.
e:\lxs>pip install pyright python-lsp-server
pip install pyright python-lsp-server
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: pyright in .\anaconda\lib\site-packages (1.1.248)
Requirement already satisfied: python-lsp-server in .\anaconda\lib\site-packages (1.4.1)
Requirement already satisfied: nodeenv>=1.6.0 in .\anaconda\lib\site-packages (from pyright) (1.6.0)
Requirement already satisfied: python-lsp-jsonrpc>=1.0.0 in .\anaconda\lib\site-packages (from python-lsp-server) (1.0.0)
Requirement already satisfied: pluggy>=1.0.0 in .\anaconda\lib\site-packages (from python-lsp-server) (1.0.0)
Requirement already satisfied: ujson>=3.0.0 in .\anaconda\lib\site-packages (from python-lsp-server) (4.0.2)
Requirement already satisfied: setuptools>=39.0.0 in .\anaconda\lib\site-packages (from python-lsp-server) (52.0.0.post20210125)
Requirement already satisfied: jedi<0.19.0,>=0.17.2 in .\anaconda\lib\site-packages (from python-lsp-server) (0.17.2)
Requirement already satisfied: parso<0.8.0,>=0.7.0 in .\anaconda\lib\site-packages (from jedi<0.19.0,>=0.17.2->python-lsp-server) (0.7.1)
e:\lxs>
另外,我现在更新成Emacs28.1了,Spacemacs也通过gitee更新到新版,每次启动Spacemacs首页的Recent Files前面为什么显示异常字符?其中init.el中对于lsp-bridge主要添加了如下配置:
(defun dotspacemacs/user-config ()
"Configuration for user code:
This function is called at the very end of Spacemacs startup, after layer
configuration.
Put your configuration code here, except for variables that should be set
before packages are loaded."
(when (display-graphic-p)
(require 'all-the-icons))
;; ;; or
;; (use-package all-the-icons
;; :if (display-graphic-p))
(add-to-list 'load-path "e:/lxs/.emacs.d/lisp/")
(add-to-list 'load-path "e:/lxs/.emacs.d/lisp/lsp-bridge/")
(add-to-list 'load-path "e:/lxs/.emacs.d/lisp/lsp-bridge/completion/")
(add-to-list 'load-path "e:/lxs/.emacs.d/lisp/lsp-bridge/core/")
(require 'lsp-bridge) ;; load lsp-bridge
(global-corfu-mode) ;; use corfu as completion ui
(require 'lsp-bridge-orderless) ;; make lsp-bridge support fuzzy match, optional
(require 'lsp-bridge-icon) ;; show icon for completion items, optional
(global-lsp-bridge-mode)
(when (display-graphic-p)
(require 'all-the-icons))
(use-package corfu
;; Optional customizations
;; :custom
;; (corfu-cycle t) ;; Enable cycling for `corfu-next/previous'
;; (corfu-auto t) ;; Enable auto completion
;; (corfu-separator ?\s) ;; Orderless field separator
;; (corfu-quit-at-boundary nil) ;; Never quit at completion boundary
;; (corfu-quit-no-match nil) ;; Never quit, even if there is no match
;; (corfu-preview-current nil) ;; Disable current candidate preview
;; (corfu-preselect-first nil) ;; Disable candidate preselection
;; (corfu-on-exact-match nil) ;; Configure handling of exact matches
;; (corfu-echo-documentation nil) ;; Disable documentation in the echo area
;; (corfu-scroll-margin 5) ;; Use scroll margin
;; Enable Corfu only for certain modes.
;; :hook ((prog-mode . corfu-mode)
;; (shell-mode . corfu-mode)
;; (eshell-mode . corfu-mode))
;; Recommended: Enable Corfu globally.
;; This is recommended since Dabbrev can be used globally (M-/).
;; See also `corfu-excluded-modes'.
:init
(global-corfu-mode))
;; A few more useful configurations...
(use-package emacs
:init
;; TAB cycle if there are only few candidates
(setq completion-cycle-threshold 3)
;; Emacs 28: Hide commands in M-x which do not apply to the current mode.
;; Corfu commands are hidden, since they are not supposed to be used via M-x.
;; (setq read-extended-command-predicate
;; #'command-completion-default-include-p)
;; Enable indentation+completion using the TAB key.
;; `completion-at-point' is often bound to M-TAB.
(setq tab-always-indent 'complete))
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/"))
(package-initialize)
(use-package markdown-mode
:ensure t
:mode ("README\\.md\\'" . gfm-mode)
:init (setq markdown-command "multimarkdown"))
(use-package orderless
:ensure t
:custom
(completion-styles '(orderless basic))
(completion-category-overrides '((file (styles basic partial-completion)))))
(require 'orderless)
(setq completion-styles '(orderless basic)
completion-category-overrides '((file (styles basic partial-completion))))
(require 'posframe)
;; (when (posframe-workable-p)
;; (posframe-show " *my-posframe-buffer*"
;; :string "This is a test"
;; :position (point)))