简体   繁体   English

获取“语法错误:无效语法”

[英]Getting “SyntaxError: invalid syntax”

I'm new to Python, and keep getting a "syntax error".我是 Python 的新手,并且不断收到“语法错误”。 With Windows 7, I start in command prompt, and enter the python terminal.使用 Windows 7,我在命令提示符下启动,然后输入 python 终端。 I receive the warning我收到警告

Warning: This Python interpreter is in a conda environment, but the environment has not been activated.警告:此 Python 解释器处于 conda 环境中,但该环境尚未激活。 Libraries may fail to load.库可能无法加载。 To activate this environment please see https://conda.io/activation .要激活此环境,请参阅https://conda.io/activation

Following the instructions there, I enter:按照那里的说明,我输入:

conda activate myenv  

(with myenv replaced with the folder containing the path to python.exe) It seems I always get (将 myenv 替换为包含 python.exe 路径的文件夹)似乎我总是得到

"SyntaxError: invalid syntax" “语法错误:无效语法”

You should enter conda activate myenv before starting python, if I understand it correctly如果我理解正确,您应该在启动 python 之前输入conda activate myenv

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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