Home  >  Article  >  Backend Development  >  How to use python on mac

How to use python on mac

藏色散人
藏色散人Original
2019-10-17 11:40:2012700browse

How to use python on mac

How to use python on mac?

Build a python environment on mac: The mac system actually comes with a python execution environment, which is fine for running python, but it may not be enough for development, so we need to reinstall python.

How to use python on mac

Recommended: "Python Tutorial"

There are two installation solutions: 1.homebreWbrew install python, this solution is relatively simple , if something goes wrong, you can try adding sudo to the front. The installed python may not be the latest version.

How to use python on mac

Download and install from the official website. You can download and install the latest version of python from https://www.python.org/download. The installation is relatively brainless. Just press it all the way. OK, the disadvantage is that you have to maintain it yourself for future upgrades and uninstallations.

How to use python on mac

The locations of python installed by these two methods are different. You can use: which python to view the installation location. After the installation is complete, type python in the terminal. Verify that the installation was successful.

How to use python on mac

Terminal execution: cd to the folder directory, add #!/usr/bin/env python in the first line of the file, add permissions chmod 777 filename.py, and execute the script. /filename.py, simple script: files.py.

How to use python on mac

The above is the detailed content of How to use python on mac. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn