简体   繁体   中英

Syntax Error when setting Python Environment variable on installation

I want to learn python so I tried to install python 2.7, but when I set the environment, there was an error telling the syntax error that reverse to the first colon. Anyone help me, please?

>>> [Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27", "User")
SyntaxError: invalid syntax

The command [Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\\Python27", "User") is not an python command instead this an operating system command to the set the PATH variable.

You are getting this error as you are inside the Python interpreter which was triggered by the command python you have entered in the terminal (Windows PowerShell) .

Please note the >>> at the left side of the line. It states that you are on inside Python interpreter

Please enter quit() to exit the python interpreter and then type the command. It should work!

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