MACBOOK Pro M1,在vscode里面试了一下python是能够运行的。


但是在终端机里面运行的时候就出现了 zsh:command not found

看了一圈然后创建了.zshrc文件和.bash_profile文件, 再把下面三行脚本加了进去。

现在变长能看到python版本(本来是看不到的),s输入python也能直接运行python。


但运行helloworld.py的时候就是出现zsh:command not found,怎么解决啊?
MACBOOK Pro M1,在vscode里面试了一下python是能够运行的。


但是在终端机里面运行的时候就出现了 zsh:command not found

看了一圈然后创建了.zshrc文件和.bash_profile文件, 再把下面三行脚本加了进去。

现在变长能看到python版本(本来是看不到的),s输入python也能直接运行python。


但运行helloworld.py的时候就是出现zsh:command not found,怎么解决啊?
python hello_world.py;#!/usr/bin/env python,然后终端运行 chmod +x hello_world.py 给程序加上执行权限,然后在终端内运行 ./hello_world.py。注意一定要有这个 ./。示例:
#!/usr/bin/env python
print('-----')
print('hello world')
print('-----')