python安装完,测试报错
> python
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'python' is not defined
首先,查看python环境变量有没有配置
我的电脑 – 右击 – 属性 – 高级系统设置 – 环境变量(N) – Path – 编辑 – 新建(N)
如果是在 python控制台下输入报错
原因:输入途径出错
需要在cmd控制台输入
C:\Users\stu>python
Python 3.12.0b3 (tags/v3.12.0b3:f992a60, Jun 20 2023, 12:25:40) [MSC v.1936 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
在python控制台可以输
>>> print('hello')
hello
>>> print(12)
12