简体   繁体   中英

Issue trying to add Python27 to path through command-line/gitbash

I am trying to add python 2.7 to my currently set path in the command line. I can not get it to add.

My current path looks like this

Environment variable python "C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\ProgramData\\DockerDesktop\\version-bin;C:\\Program Files\\Docker\\Docker\\Resources\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files\\Tumbleweed\\Desktop Validator\\;C:\\Program Files\\Tumbleweed\\Desktop Validator\\x86;C:\\Program Files (x86)\\HID Global\\ActivClient\\;C:\\Program Files\\HID Global\\ActivClient\\;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Program Files\\Git\\cmd;C:\\Program Files\\nodejs\\;C:\\Users\\jandali\\AppData\\Local\\Microsoft\\WindowsApps;;C:\\Python27\\Lib" not defined

at then end it said that Environment varialbe python is not defined.

I tried the following commands

set "%path%;C:\\Python27"

and

set "%path%;C:\\Python27\\Lib"

not sure why it is saying that it is not defined when it is at the end of the paths...

when I run python or python27 , it says that command was not recognized

not sure how to fix this.

On standard Windows command line, the error you have is because

set "%path%;C:\Python27"

expands as

set superlongcurrentuser+systempath;C:\python27

and the variable name just created isn't a valid name. You want:

set path="%path%;C:\Python27"

(in windows, paths are separated by semicolons, not colons like on unix/linux)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM