问题描述
当我使用 python
文件启动Visual Studio Code时,我开始出现以下错误
When I start Visual Studio Code with a python
file I started getting the following error
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.
我检查了路径,确实出现了 ;; .我删除了它,但是仍然出现错误.
I checked my path and I did indeed have a ;; appearing. I removed it but, I'm still getting the error.
这是我当前的路径.
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
依次包含以下文件夹路径:
Your local PATH
contains the following folder paths in this order:
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
中,没有包含用双引号引起来的文件夹路径,也没有包含分号的路径,也没有两个分号.
So in local PATH
there is no folder path included being surrounded by double quotes and there is also no path containing a semicolon nor are there two semicolons.
PATH
中的文件夹路径不应以反斜杠结尾.可能的是,Microsoft本身默认在 system PATH
中添加了带有尾部反斜杠的PowerShell文件夹路径.但是我建议在Windows系统控制面板的高级系统设置中修复该问题.
Folder paths in PATH
should not end with a backslash. It is possible and Microsoft itself added PowerShell folder path with a trailing backslash by default to system PATH
. But I recommend fixing that in advanced system settings of Windows system control panel.
系统 PATH
和用户 PATH
的最后一个文件夹路径后不应有分号.某些编码不好的应用程序或脚本会在开始时始终使用分号将文件夹路径附加到 local PATH
,而无需首先检查PATH
是否已经以分号结尾.这将导致本地 PATH
最终包含;;
.因此,应删除C:\Python36
之后的分号.
There should be no semicolon after last folder path of system PATH
and user PATH
. Some not good coded applications or scripts append folder paths to local PATH
with always a semicolon at beginning without checking first if PATH
ends already with a semicolon. This results in local PATH
containing finally ;;
. The semicolon after C:\Python36
should be removed for that reason.
系统 PATH
中的前四个文件夹路径应始终为:
And the first four folder paths in system PATH
should be always:
%SystemRoot%\system32
%SystemRoot%
%SystemRoot%\System32\Wbem
%SystemRoot%\System32\WindowsPowerShell\v1.0
这表示环境变量对话框中显示并存储在Windows注册表中的系统 PATH
应该始终以以下内容开头:
This means the system PATH
as shown in environment variables dialog and stored in Windows registry should start always with:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0
一些编码不好的安装程序会在最重要的文件夹路径(Windows系统文件夹)之前插入文件夹路径.这也应该由您解决.
Some not good coded installers insert folder paths before the most important folder path – the Windows system folder. That should be fixed by you, too.
我认为问题是由C:\Python36
之后的;
导致的,该批处理文件仅包含命令行:
I suppose the issue is caused by ;
after C:\Python36
with a batch file containing just the command line:
set "PATH=%PATH%;C:\Folder Path"
或者批处理文件包含命令行:
Or a batch file contains the command line:
set PATH="%PATH%;C:\Folder Path"
该命令行破坏了 local PATH
环境变量,因为将用分号分隔的文件夹路径列表更改为一个无效的文件夹路径.
That command line corrupts the local PATH
environment variable because of changing the semicolon separated list of folder paths into one invalid folder path.
另请参阅:
- Why is no string output with 'echo %var%' after using 'set var = text' on command line?
- What is the reason for '...' is not recognized as an internal or external command, operable program or batch file?
这篇关于VS Code python扩展最近开始抱怨Win10上的Path错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!