python 命令不起作用,并且没有显示错误
python command does not work, and shows no error
我刚刚安装了 Python,并且确实添加了两者
"C:\Users\xxxxx\AppData\Local\Programs\Python\Python310"
"C:\Users\xxxxx\AppData\Local\Programs\Python\Python310\Scripts"
在路径环境变量中。
在cmd中,我可以调用pip没有问题。
但我似乎无法运行 python 代码 python .\myproject.py
,并且没有错误文本打印。
没有任何打印,没有错误或警告消息,它刚刚结束。
所以我运行一个简单的打印文件,但仍然没有打印任何东西。
测试文件是:
def main():
print("Hi")
if __name__ == "__main__":
main()
我修改Python安装后问题解决,勾选“Add Python to environment variables”选项。
我认为以下文章有助于理解问题和区别:
What is the difference between 'py' and 'python' in the Windows terminal?
我刚刚安装了 Python,并且确实添加了两者
"C:\Users\xxxxx\AppData\Local\Programs\Python\Python310"
"C:\Users\xxxxx\AppData\Local\Programs\Python\Python310\Scripts"
在路径环境变量中。
在cmd中,我可以调用pip没有问题。
但我似乎无法运行 python 代码 python .\myproject.py
,并且没有错误文本打印。
没有任何打印,没有错误或警告消息,它刚刚结束。
所以我运行一个简单的打印文件,但仍然没有打印任何东西。
测试文件是:
def main():
print("Hi")
if __name__ == "__main__":
main()
我修改Python安装后问题解决,勾选“Add Python to environment variables”选项。
我认为以下文章有助于理解问题和区别:
What is the difference between 'py' and 'python' in the Windows terminal?