Mac运行Python程序
一、如何运行.python文件
方法一:在终端中执行
python test.py
方法二:使用Python Launcher
新建一个.py的文本,在文本顶部指定python的版本。如图:
然后对着.py文件进行右键,选择Python Launcher进行打开,Python Launcher配置如图:
二、可能出现的问题
- 运行python程序时,提示
No module named 'requests',说明此时没有安装requests,在命令行中安装,输入命令:pip install requests,如提示command not found,则应输入:pip3 install requests。 缺什么模块就安装什么模块。