Download installation
Open the terminal or item2 to see if Python is installed. The OS comes with Python, but the version is rather old.
Install via homebrew (AppStore for development software): View homebrew and Python documentation
- Search Python brew search Python to see the Python version first
- Type the command brew install Python3 installation Python3
- After the installation is complete, type python-v to see if the installation was successful.
You need to turn on VPN,PIP and Setuptools also install at the same time:
Official Download Install : https://www.python.org/downloads/mac-osx/, some trouble. Recommended homebrew installation.
Three ways to run Python:1, interactive interpreter:
The command-line window enters Python and starts writing Python code in the interactive interpreter.
Python coding can also be done in Unix,dos or any other system that provides a command line or shell.
$python # unix/linux# or python% # Unix/linux
The following are the Python command-line parameters:
- -D displays debug information at parse time
- -O Generate Optimization code (. pyo file)
- -S does not introduce a location to find Python paths when booting
- -V Output Python version number
- -X is obsolete based on the built-in exception (for strings only) since version 1.6.
- -C CMD executes the Python script and runs the result as a CMD string.
File executes the Python script in the given Python file.
2. Command line script
In your application, you can execute a python script on the command line by introducing an interpreter, as follows:
$python script.py # unix/linux# or python% script.py # Unix/linux
Note: When executing a script, check to see if the script has executable permissions.
3. IDE for integrated development environment
Pycharm:
Python installation configuration and Operation-mac