gpt4 book ai didi

python - VS Code python 扩展最近开始提示 Win10 上的路径错误

转载 作者:太空狗 更新时间:2023-10-29 21:02:12 25 4
gpt4 key购买 nike

当我使用 python 文件启动 Visual Studio Code 时,我开始收到以下错误

The environment variable 'Path' seems to have 
some paths containing characters (';', '"' or ';;').
The existence of such characters are known to have
caused the Python extension to not load. If the
extension fails to load please modify your paths to
remove these characters.

我检查了路径,确实出现了 ;;。我删除了它,但我仍然收到错误消息。

这是我目前的路径。

PATH=C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Common Files\Lenovo;C:\SWTOOLS\ReadyApps;C:\Program Files\Calibre2\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\IDM Computer Solutions\UltraEdit;C:\Users\Dave\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Git\cmd;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Sophos\Sophos SSL VPN Client\bin;C:\Users\Dave\AppData\Local\atom\bin;C:\Users\Dave\AppData\Local\Microsoft\WindowsApps;C:\sqlite;C:\Python36\Scripts;C:\Program Files\Microsoft VS Code\bin;C:\Python36;

最佳答案

您的本地 PATH 包含以下顺序的文件夹路径:

C:\ProgramData\Oracle\Java\javapath
C:\Program Files (x86)\Intel\iCLS Client\
C:\Program Files\Intel\iCLS Client\
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL
C:\Program Files\Intel\Intel(R) Management Engine Components\IPT
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT
C:\Program Files (x86)\Common Files\Lenovo
C:\SWTOOLS\ReadyApps
C:\Program Files\Calibre2\
c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\
c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\
C:\Program Files (x86)\Skype\Phone\
C:\Program Files\IDM Computer Solutions\UltraEdit
C:\Users\Dave\.dnx\bin
C:\Program Files\Microsoft DNX\Dnvm\
C:\Program Files\Git\cmd
C:\WINDOWS\System32\OpenSSH\
C:\Program Files\Intel\WiFi\bin\
C:\Program Files\Common Files\Intel\WirelessCommon\
C:\Program Files (x86)\Sophos\Sophos SSL VPN Client\bin
C:\Users\Dave\AppData\Local\atom\bin
C:\Users\Dave\AppData\Local\Microsoft\WindowsApps
C:\sqlite
C:\Python36\Scripts
C:\Program Files\Microsoft VS Code\bin
C:\Python36

因此在 local PATH 中没有包含双引号的文件夹路径,也没有包含分号的路径,也没有两个分号。

PATH 中的文件夹路径不应以反斜杠结尾。这是可能的,Microsoft 本身默认将带有尾部反斜杠的 PowerShell 文件夹路径添加到 system PATH。但我建议在 Windows 系统控制面板的高级系统设置中修复它。

system PATHuser PATH 的最后一个文件夹路径后不应有分号。一些编码不佳的应用程序或脚本将文件夹路径附加到 local PATH 开头始终带有分号,而不首先检查 PATH 是否已以分号结尾.这导致 local PATH 最终包含 ;;。由于这个原因,C:\Python36 之后的分号应该被删除。

system PATH 中的前四个文件夹路径应始终为:

%SystemRoot%\system32
%SystemRoot%
%SystemRoot%\System32\Wbem
%SystemRoot%\System32\WindowsPowerShell\v1.0

这意味着在环境变量对话框中显示并存储在 Windows 注册表中的系统 PATH 应始终以:

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0

一些编码不佳的安装程序会在最重要的文件夹路径(Windows 系统文件夹)之前插入文件夹路径。这也应该由您来解决。

我想这个问题是由 ;C:\Python36 之后用一个只包含命令行的批处理文件引起的:

set "PATH=%PATH%;C:\Folder Path"

或者一个包含命令行的批处理文件:

set PATH="%PATH%;C:\Folder Path"

该命令行破坏了 local PATH 环境变量,因为将分号分隔的文件夹路径列表更改为一个无效的文件夹路径。

另见:

关于python - VS Code python 扩展最近开始提示 Win10 上的路径错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50989592/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com