Install Python on your Mac so you can use it. Python2 series is originally installed on Mac, but this time Python3 series is installed.
To get started with Python, you must first be able to use Python. The first thing that stumbles when you start programming is building an environment. I wanted to write a procedure that would be helpful for anyone who wants to get started with Python. Since it is for beginners, I do not think about complicated things such as installing it in a virtual environment.
① Learn command operations ② Install Python
Learn Mac command operations before installing Python. You can do this a little and programming will be fun.
ls #Show inside the folder
ls -a #Show all files and folders, including hidden files
cd #Move folders
pwd #Show folder path
touch #Create an empty file
mkdir #Create a folder
mv #Move folders and files
cp #make a copy
rm #Delete file
rm -r #Delete the folder
open #Open file
For the time being, I think that if you remember this much, you can operate it somehow.
https://www.python.org/downloads/
After successful installation, enter the following command in the terminal. OK if the installed Python version is displayed.
python3 --version
Check .bash_profile (hidden file directly under your home directory). The following content should be described. If not, create a file and write in the same way. (Pass through PATH)
# Setting PATH for Python 3.8
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}"
export PATH
Describe the following in .bashrc. If not, create a file and write in the same way.
alias python=python3
alias pip=pip3
In addition, add the following to .bash_profile.
#.For reading bashrc
source ~/.bashrc
Now you can put it in your PATH. Since Python 2 system is installed on Mac, future development will be smooth if you pass it through PATH. You will be able to run it in Python without having to enter Python 3 each time.
The first thing that stumbles in programming is environment construction. I think I'll stumble when I go through the PATH. I haven't written the details this time, but I'd like you to follow the procedure anyway. If you can do this, you can start Python.
-Mac Terminal Command List (Basic) -[Python3] Summary of steps to install the latest version of Python on a clean Mac
Recommended Posts