How To Update Python Libraries On Mac Terminal

OKI was afraid to use the terminal, so I installed the python-3.7.2-macosx10.9 package downloaded from python.orgRan the certificate and shell profile scripts, everything seems fine.Now the 'which python3' has changed the path from 3.6 to the new 3.7.2

So everything seems fine, correct?

My question (of 2) is what's going on with the old python3.6 folder still in the applications folder. Can you just delete it safely? Why when you install a new version does it not at least ask you if you want to update or install and keep both versions?

Second question, how would you do this from the terminal?I see the first step is to sudo to the root.I've forgotten the rest.But from the terminal, would this simply add the new version and leavethe older one like the package installer?It's pretty simple to use the package installer and then delete a folder.

So, thanks in advance. I'm new to python and have not much confidence using the terminal and all the powerful shell commands.

And yeah I see all the Brew enthusiasts. I DON'T want to use Brew for the moment.

Update: These instructions are over a year old, though they may still work for you. See the 'Install Python' page for the most up-to-date instructions. I've already written a post about installing Python, NumPy, SciPy, and matplotlib on Lion, but it involves a lot of working at the command line, modifying your.bashprofile and dealing with. Now to install Python 3 via Homebrew, run the following command in Terminal: brew install python3. When Python 3 is installed on a Mac, you can start the program with: python3. In any case, after installing Python 3 on a computer, the version of Python 2.7 will still remain on it, and you will be able to use it.

Mac

The python snakes nest of pathways is a little confusing, for the moment.I don't want to get lost with a zillion pathways from Brew because it'sconfusing for the moment.

I love Brew, leave me alone.

Python is a versatile language used for multi-purpose programming it is undoubtedly the most popular dynamic programming language that is being used today.

Python

Python is an open source object-oriented programming language made by Dutchman Guido van rossum in 1991.

Python is an excellent choice for beginners and experienced developers, Python 3 is the most current version of the language and is considered to be the future of Python.

Python 2.X comes preinstalled on Mac.

You can verify it by running python --version in your terminal; you should get a similar output

But if you check for Python 3 by running python3 --version you will get an error unless you already have Python 3 installed.

If you are wondering why you should install Python 3 read The key difference between Python 2 and Python 3

There are various ways to install Python 3, including a download from the official Python site. However, I strongly recommend instead use a package manager like Homebrew to manage all your packages. It will save you from a lot of headaches.

This tutorial will guide you through installing Python 3 on your local macOS machine and setting up a programming environment via the command line.

How to install Python 3 in Mac

Before preceding a quick Note – We’ll be completing most of our installation and set up on the command
line, which is a non-graphical way to interact with your computer.

Step – 1

Open your terminal, you can find it by going into Finder, navigating to the Applications folder, and then into the Utilities folder. Alternatively, you can use Spotlight by holding down the command and spacebar keys to find Terminal by typing it out in the box.

How To Update Python Libraries On Mac Terminal 2

Step – 2

Xcode is an integrated development environment (IDE) that is comprised of software development tools for macOS. You may have Xcode installed already on your system. To check, in your Terminal window, execute this command – xcode-select -p

If you receive the following output, then Xcode is installed:

/Library/Developer/CommandLineTools

If you get an error then you need to install Xcode first, you can simply install it from the App store Install Xcode

Once Xcode is installed, return to your Terminal window. Next, you’ll need to install Xcode’s separate Command Line Tools app, which you can do by executing the following command.

Click through all the confirmation commands this may take a while.

Once Xcode and its Command Line Tools app are fully installed, and we are ready to install the package manager Homebrew.

Step -3

In this step, we will install Homebrew which is a package manager. A package manager is a collection of software tools that work to automate installation processes that include initial software installation, upgrading and configuring of software, and removing software as needed.

To install Homebrew run the following command in your terminal –

Homebrew installs packages to their own directory and then symlinks their files into /usr/local.

Install Python Mac Terminal

To confirm the Homebrew installation run this command

Otherwise, you may get a warning to run another command such as brew update to ensure that your installation of Homebrew is up to date.

Once Homebrew is ready, you can proceed further to install Python 3.

Step – 4

Finally, now you can install the latest version of Python by running

The Terminal window will give you feedback regarding the installation process of Python 3. Along with Python 3, Homebrew will install some essential tools such as pip, setuptools, and wheel.

Pip is a valuable tool used to install and manage Python packages. You will use it a lot in your projects.

To verify Python 3 installation, you can run the following

Your version might slightly vary, but as long as it’s Python 3 the installation was successful.

To open a Python 3 shell from the command line type python3:

To exit the shell simple type exit() and hit enter.

Note you can still run Python shells with Python 2 by executing python:

Upgrade Python Mac Terminal

As the installation is complete go ahead and run your first Python program by following this guide – How to run “Hello, World!” program in Python 3

How to update Python3?

If in future Python team publishes a new update you can update your Python 3 from the terminal by doing the following.

Update Python Mac Terminal

This will update your Homebrew first followed by Python 3.

How to Create a Virtual Environment in Mac os?

How To Update Python Libraries On Mac Terminal

If you have been Following this guide, Now you have Python 2 and Python 3 installed in your Mac.

Unfortunately, there is a lot of contrast between these two versions, Python 3 was introduced to eliminate all the design flaws of the previous version. It brought a lot of changes you can read about them here

So the problem is almost every time, Programs written of Python 2 won’t work on Python 3 environment. And Python 2 package Might create a conflict in Python 3 program.

Update Python In Terminal

To prevent such situations, it is always recommended to create virtual environments to run Python 2.7 for one project and Python 3.7 for another on the same computer, follow this guide to learn how to create Virtual environments on Mac.