Mac Install Python3 Pip

Once Python 3 is installed on your Mac, from Terminal run: python3 -m pip install -upgrade virtualenv Python Virtual Environment. (pip install venv or pip install virtualenv) Note: it is possible to install and run F´ without a virtual environment, however; for individuals and researchers, this is the recommended approach. By the way, if you're wondering why I keep referring to Python 3.x – the x is a stand-in for sub-versions (or point releases as developers call them.) This means any version of Python 3. How to Install Homebrew on Mac. First you need to install Homebrew, a powerful package manager for Mac. Open up your terminal.

Pip is the standard package manager for Python. It enables the installation and management of third party packages that provide features and functionality not contained in the Python standard library. Newer versions of Python (Python 2 >= v2.7.9 or Python 3 >= v3.4) come prepackaged with pip by default. Pip is also included in the virtual environments created by virtualenv and pyvenv.

But if your default Python is an older version of Python, pip will need to be manually installed. This tutorial steps through how to:

Mac install python 3 pip windows 10
  • Install pip on your Windows or macOS operating system
  • Use pip to manage your environment

Prerequisites for Pip Installation

Check to see which version of Python you have installed by running the following command:

Depending on your Python installation, you should see something like the following:

If you do not have a version of Python installed, you can quickly download and install a recent version of ActiveState.

Check to see if pip is already installed by running the following on the command line:

You should see something similar to the following output:

Install Pip on Windows or Mac

To manually install pip on Windows or Mac (including Mac OS X), you will need a copy of For older Python versions, you may need to use the appropriate version of the file from You can get a copy of the installer by downloading the file to a folder on your computer, or else just use the following curl command:

Next, run the following command to install pip:

If the file is not found, you may need to first navigate to the directory containing the file. For a Windows installation, you should see something similar to the following:

Installing collected packages: pip, setuptools, wheel

The script wheel.exe is installed in ‘C:Python33Scripts’ which is not on PATH.

Consider adding this directory to PATH or, if you prefer to suppress this warning, use

This command will also install setuptools and wheel if they are not already installed.

Add Pip to Windows Environment Variables

Mac python3 install pip3

One of the most common problems with running Python tools like pip is the “not on PATH” error. This means that Python cannot find the tool you’re trying to run in your current directory. There are two solutions:

  • Navigate to the directory in which pip is installed every time before you run pip, or else prefix the command with the path.
  • Add the directory in which pip is installed as a PATH environment variable so you can run it from any location.

You can update the PATH environment variable on Windows by doing the following:

  1. Open up the Control Panel and navigate to System and Security > System
  2. Click on the Advanced system settings link on the left panel
  3. Click Environment Variables.
  4. Under System Variables, double-click the variable PATH.
  5. Click New, and add the directory where pip is installed, e.g. C:PythonScripts, and select OK.

Add Pip to the Mac Environment Variables

One of the most common problems with running Python tools like pip is the “not on PATH” error. This means that Python cannot find the tool you’re trying to run in your current directory.

The best solution is to edit your .bash_profile by doing the following:

And then add in the following commands:

Mac Python3 Install Pip3

Where “your path” might be something like:

Save the file and check whether the PATH has been updated by running:

Upgrade Pip

In order to keep your version of pip up to date, you can run the following on the command line:

This command will uninstall the outdated version of pip first, and then download the latest version.

Using Pip to Manage Environments

Pip is the default package manager for Python that most developers use to manage their Python global and virtual environments by installing, updating and uninstalling packages and their dependencies. By default, pip installs packages located in the Python Package Index (PyPI), but can also install from other indexes.

Unfortunately, pip does not resolve dependencies, which means it’s possible to corrupt your environment, especially when performing updates of packages in the site-packages directory. Instead, consider installing Python from ActiveState for Windows and Linux and then importing your requirements file. The ActiveState Platform will automatically resolve all packages and their dependencies to ensure against conflicts.

Pip Package Installation

Python packages installed with pip are typically bundled into ‘wheels’ prior to installation. A wheel is a zip-style archive that contains all the files necessary for a typical package installation. Wheels have a .whl extension, and provide a simpler installation than ‘non-wheel’ packages.

Mac Install Python3 Pip

To install a package:

To install a specific version of a package:

For example,

To install a package from a repository other than PyPI, for instance, Github:

Mac Install Python 3 Pipes

To upgrade a package that is already installed:

To uninstall a package:

To show help for pip, including complete command usage and options:

Pipenv Package Installation

Pipenv is a tool for managing dependencies. It uses pip and virtualenv under the hood (you may need to install virtualenv if it isn’t already installed), and simplifies their usage with a single command line syntax. Like venv, pipenv automatically creates a new virtual environment for each project.

To install, upgrade or uninstall packages within pipenv, just replace the pip command with pipenv. For example, the following command installs a named package from PyPI:

You can also install packages into your Python virtual environment from locations other than PyPI. For example, the following command installs the requests package from a Github repository:

Install Python Packages the secure, modern way

The ActiveState Platform is a package management solution for Python, Perl and Tcl that automatically creates a virtual environment on all main operating systems, including Windows, Linux or macOS whenever you install a new Python project.

The ActiveState Platform provides a command line interface, the State Tool, which automatically:

  • Creates a project folder for your virtual environment
  • Builds Python from source code, downloads and installs it in the virtual environment
  • Builds all packages/dependencies from source code, downloads and installs them into the virtual environment

In this way, you don’t need to have Python or venv or virtualenv or pipenv installed before you can create a virtual environment. Anytime you need to start a new Python project or create a new Python installation, you can simply run a single command to:

  • Download and install Python and the Python interpreter
  • Download and install key dependencies like and setuptools

You can watch a video to see how to install Python 3.9 into a virtual environment, or you can simply try it out for yourself:

For Windows, run the following command at a CMD prompt:

For Linux run the following command:

You can then install any Python packages your project requires by running:

Mac Install Python3 Pip


For more information on how to use the State Tool, refer to the User Guide.

Ready to see for yourself? You can try the ActiveState Platform by signing up for a free account using your email or GitHub credentials. Or sign up for a free demo and let us show you how you can automatically build your Python environment in minutes.

MacOS comes with Python pre-installed. But it's Python Version 2.7, which is now deprecated (abandoned by the Python developer community).

The entire Python community has now moved on to using Python 3.x (the current version as of writing this is 3.9). And Python 4.x will be out soon, but it will be completely backward compatible.

If you try to run Python from your MacOS terminal, you'll even see this warning:

Until Apple decides to set Python 3.x, as the default you're going to have to install it yourself.

A Single Command to Run Python 3

For some of you reading this, this command may be enough. You can run Python 3 using this command (with the 3 at the end).

If that's all you came for, no worries. Have a fun day and happy coding.

But if you want a proper Python version control system to keep track of various versions – and have fine-grain control over which version you use – this tutorial will show you exactly how to accomplish this.

How to Install Homebrew on Mac

First you need to install Homebrew, a powerful package manager for Mac.

Open up your terminal. You can do this by using MacOS spotlight (command+space) and typing 'terminal'.

Now that you're in a command line, you can install the latest version of Homebrew by running this command:

Your terminal will ask for Super User-level access. You will need to type your password to run this command. This is the same password you type when you log into your Mac. Type it and hit enter.

Homebrew will ask you to confirm you want to install the following. You have to press enter to continue. (Or press any other key if you get cold feet.)

How to Install pyenv to Manage Your Python Versions

Now let's take a moment to install PyEnv. This library will help you switch between different versions of Python (in case you need to run Python 2.x for some reason, and in anticipation of Python 4.0 coming).

Run this command:

Now you can install the latest version of Python.

How to Use pyenv to Install Python or Update Your Python Version

Now you just need to run the following command:

Note that you can substitute 3.9.2 for whatever the latest version of Python is. For example, once Python 4.0.0 comes out, you can run this:

Troubleshooting pyenv Installation

If you encounter an error that 'C compiler cannot create executables' then the simplest way to solve this is to reinstall Apple's Xcode.

Xcode is a tool created by Apple that includes all the C libraries and other tools that Python uses when it runs on MacOS. Xcode is a whopping 11 gigabytes, but you'll want to be up-to-date. You may want to run this while you're sleeping.

You can get the latest version of Apple's Xcode here. I had to do this after upgrading to MacOS Big Sur, but once I did, all the following commands worked fine. Just re-run the above pyenv install 3.9.2 and it should now work.

How to Set Up Your MacOS PATH for pyenv (Bash or ZSH)

First you need to update your Unix path to pave a way for PyEnv to be able to interact with your system.

This is a long explanation of how PATH works in MacOS (and Unix), straight from the pyenv GitHub repo.

When you run a command like python or pip, your operating system searches through a list of directories to find an executable file with that name. This list of directories lives in an environment variable called PATH, with each directory in the list separated by a colon:
Directories in PATH are searched from left to right, so a matching executable in a directory at the beginning of the list takes precedence over another one at the end. In this example, the /usr/local/bin directory will be searched first, then /usr/bin, then /bin.

And here is their explanation of what a Shim is. I'm quoting them at length again because I really can't explain this better myself.

pyenv works by inserting a directory of shims at the front of your PATH:
Through a process called rehashing, pyenv maintains shims in that directory to match every Python command across every installed version of Python—python, pip, and so on.
Shims are lightweight executables that simply pass your command along to pyenv.

Here's how to update your .bash_profile in Bash (which is installed in MacOS by default):

Or if you've installed ZSH (or OhMyZSH) like I have, you'll want to edit the .zshrc file instead:

Then you want to add PyEnv Init to your terminal. Run this command if you're using Bash (again, this is the default with MacOS):

Or run this command if you're using ZSH:

Now reset your terminal by running this command:

How to Set a Version of Python to Global Default (Bash or ZSH)

You can set the latest version of Python to be global, meaning it will be the default version of Python MacOS uses when you run Python applications.

Run this command:

Again, you can replace 3.9.2 with whatever the latest version is.

Now you can verify that this worked by checking the global version of Python:

You should see this output:

The Final Step: Close Your Terminal and Restart it

Mac Install Python3 Pip

Once you've restarted your browser, you run the python command and you'll launch the new version of Python instead of the old one.

Congratulations. Thank you for reading this, and happy coding.