How To Update Python Libraries On Mac Terminal

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

How do you include extra Python libraries on Mac Tag: python, osx I would like to include different Python libraries on my Mac, like numpy and other research libraries that aren't packaged by default with the Python installation.

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.

  • Jun 13, 2018  TLDR: Don’t Update Python 2.x to Python 3.x, Just Install Python 3.x on the Mac TLDR: Don’t update the preinstalled Python 2.x to Python 3.x, it will likely break something in doing so. Instead, just install and run the updated Python 3 separately.
  • Dec 15, 2012  A small description on how to program using Python Programming Language on Mac OS's Terminal. We don't need any third party Python Interpreter / compiler to do so. Simply type '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.

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.

To confirm the Homebrew installation run this command

Making the /Library Folder Visible in OS X 10.8 Mountain LionIn OS X 10.8 Mountain Lion you can access the aforementioned folder using Finder using the following steps.1. How to access library application support google drivefs on mac.

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

I used the following CLI code to install libbluray: git clone online point me to get the KEYDB.cfg file but as you can see, that just takes me to a Russian website that says 'In the coming days, the site will be restored.' I've done a bit of googling and according to on Doom9's forum, the 'KEYDB.cfg' file is now unavailable. This blu ray disc needs a library for aacs mac. Another suggested alternative on Doom9's forum is to use MakeMKV- but as far as I can tell MakeMKV costs money to be able to rip Blu-Ray discs and VLC media player is open-source.

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.

How To Update Python Libraries On Mac Terminal

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:

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.

This will update your Homebrew first followed by Python 3.

How to Create a Virtual Environment in Mac os?

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

Terminal

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.

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.

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?

How To Update Python Mac

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.

How To Update Python Libraries On Mac Terminal 1

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.

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.