VS Code python extension recently started complaining about a Path error on Win10

痴心易碎 提交于 2019-12-20 12:47:09

问题


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.

Here is my current path.

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;

回答1:


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

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.

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.

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.

And the first four folder paths in system PATH should be always:

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

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

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.

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"

That command line corrupts the local PATH environment variable because of changing the semicolon separated list of folder paths into one invalid folder path.

See also:

  • 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?



回答2:


For me it was just a \ in the end of the Python path:

C:\Users\ME\AppData\Local\Programs\Python\Python37\Scripts\

The moment I removed the last \ the warning went off !




回答3:


I met this question and i don't know how to do: The environment variable 'Path' seems to have some paths containing the '"' character. The existence of such a character is known to have caused the Python extension to not load. If the extension fails to load please modify your paths to remove this '"' character.



来源:https://stackoverflow.com/questions/50989592/vs-code-python-extension-recently-started-complaining-about-a-path-error-on-win1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!