Installing and Using Python2 and Python3 on macOS and Accelerating pip Installations
This guide explains how macOS ships with Python 2, how to install Python 3, run both versions side‑by‑side, use pip and pip3 for package installation, and speed up slow pip installs by specifying a fast mirror.
macOS comes with Python2 pre‑installed; you can verify it by opening Terminal and typing python . The system documentation recommends using Python3 , and newer macOS releases are expected to include it as well.
To install Python 3 on macOS, download the installer from the official Python website just as you would on Windows. After installation, you can launch it in Terminal with python3 . Both Python2 and Python3 can coexist, and you may need to use pip3 install <package> for Python 3 packages, although on some Macs both pip and pip3 work interchangeably.
Examples of installing the xlrd library:
pip install xlrd – shown with a screenshot.
pip3 install xlrd – shown with a screenshot.
If pip install is slow, you can speed it up by specifying a faster mirror, such as the Tsinghua University mirror:
<code>pip install -i https://pypi.tuna.tsinghua.edu.cn/simple xlrd</code>Disclaimer: This article is compiled from online sources; copyright belongs to the original author. If any information is incorrect or infringes rights, please contact us for removal or authorization.
Python Programming Learning Circle
A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.