脚本编程与交互式编程

脚本编程与交互式编程

命令式

image-20220605222444153
image-20220605222444153

可以直接用 python 命令运行

➜  ~ python3 /media/terwer/data/workspace/terwer/pyhello/main.py
Hello World!
hello my friends

Terwer...小于 1 分钟大数据开发新思路新笔记python
Python环境搭建

搭建 Python环境

Mac 和 Linux 自带 Python ,不用额外配置,开箱即用。需要注意的是 Python 分为两个主要大版本, Python2 和 Python3 。现在推荐实用的是 Python3 ,不过有很多优秀类库是用 Python2 写的。

➜  ~ python -V
Python 2.7.16

Terwer...小于 1 分钟大数据开发新思路新笔记pythonenv
解决macOS Monterey 12.3没有python2的问题

问题

当Mac升级到macOS Monterey 12.3之后,你会发现 python2 不见了,输入 python 也提示 找不到

➜  ~ python -m pip install --user virtualenv
zsh: command not found: python

Terwer...大约 5 分钟实用技巧经验分享macosmontereypythonpython2