新安装了vscode,启动时报错,
2023-05-15 09:12:19.064 [info] [Info - 9:12:19 AM] (7176) Pylance language server 2023.5.20 (pyright 009aef31) starting
2023-05-15 09:12:19.064 [info] [Info - 9:12:19 AM] (7176) Server root directory: c:\Users\Administrator\.vscode\extensions\ms-python.vscode-pylance-2023.5.20\dist
2023-05-15 09:12:19.065 [info] [Info - 9:12:19 AM] (7176) Starting service instance "yolov5602DCode"
2023-05-15 09:12:19.065 [info] [Info - 9:12:19 AM] (11000) Pylance language server 2023.5.20 (pyright 009aef31) starting
2023-05-15 09:12:19.065 [info] [Info - 9:12:19 AM] (11000) Server root directory: c:\Users\Administrator\.vscode\extensions\ms-python.vscode-pylance-2023.5.20\dist
2023-05-15 09:12:19.071 [info] [Info - 9:12:19 AM] (11000) Starting service instance "yolov5602DCode"
2023-05-15 09:12:19.073 [info] [Error - 9:12:19 AM] Server initialization failed.
2023-05-15 09:12:19.073 [info] Error: command 'pyright.createtypestub' already exists
at e.ExtHostCommands.registerCommand (c:\Programs\MicrosoftVSCode\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:98:123788)
at Object.registerCommand (c:\Programs\MicrosoftVSCode\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:116:23226)
at t.ExecuteCommandFeature.register (c:\Users\Administrator\.vscode\extensions\ms-python.python-2023.8.0\out\client\extension.js:2:2106221)
at t.ExecuteCommandFeature.initialize (c:\Users\Administrator\.vscode\extensions\ms-python.python-2023.8.0\out\client\extension.js:2:2105800)
at S.initializeFeatures (c:\Users\Administrator\.vscode\extensions\ms-python.python-2023.8.0\out\client\extension.js:2:2057711)
at S.doInitialize (c:\Users\Administrator\.vscode\extensions\ms-python.python-2023.8.0\out\client\extension.js:2:2045260)
at async S.start (c:\Users\Administrator\.vscode\extensions\ms-python.python-2023.8.0\out\client\extension.js:2:2042275)
at async h.start (c:\Users\Administrator\.vscode\extensions\ms-python.python-2023.8.0\out\client\extension.js:2:37203)
搜索了一下,发现是vscode扩展版本引起的问题,
参考地址如下,
Error: command 'pyright.createtypestub' already exists · Issue #2765 · microsoft/pylance-release · GitHub
解决办法:
把vscode的python-extension降级到Python extension version 2022.4.1就OK了。