Change language

How To Install NumPy On A Mac

How To Install NumPy On A Mac

hey everyone in this video were going to talk about how we can install numpy into python on a mac in this video were going to be installing numpy directly from the mac terminal allowing you to use numpy in your python shells which well talk about here shortly before we begin if you do not have python installed just click on the link in the top right hand corner of your screen now or check out the link in the description below and you can quickly learn how to download and get started in python on a mac to ensure that we have python installed correctly and to get started lets hit command spacebar to open up our max search feature then lets type terminal within our terminal lets type python and then hit tab this should show you all of your python additions as i want to be working in the latest version of python lets just type 3.9 and hit enter this will show you a bit of information confirming that python is installed now we dont actually want to do anything with this right now so lets type quit parentheses like so now to work in our max terminal with python code we need to first create a virtual environment that will contain all of our projects information lets say that i also want to store this file on my macs desktop as well so it is easily findable so by typing ls and hitting enter you should see desktop as one of the directories that we can move to so lets type cd change directory and desktop now to create a python environment lets tell the terminal that we want a python 3.9 dash m vn study session so this is saying lets make a python 3.9 virtual environment called study session but you can obviously call this file whatever you wish now you can see that when we list our available desktop directories here that is what ls does we now have a file called study session which is the python environment that we just created but how do we go about entering the virtual environment well as you can see here when i list the contents of the study sessions bin we have a file called activate and were going to type source space our newly created environments name so study session slash bin slash activate now on the left side of your input line we can see that we are now working within the study session environment this line is telling python to run scripts out of the study session shell only now that our virtual environment is created lets ensure that we have the latest version of pip installed quickly though what is pip pip is a python package manager that allows us to install and utilize packages that are not a part of the standard python library lets type into our terminal window pip 3 install dash dash upgrade space pip now itll either quickly upgrade your pip or tell you that you are up to date the purpose of doing this is to prevent any potential errors that could occur during our installation of numpy as we want the latest version of the package manager after we complete upgrading our pip we can simply install numpy into our python environment so lets type pip install numpy and you can see that it will begin installing the necessary packages after doing this we can now type import numpy as mp this will import the numpy library and allow us to call it using the shorthand np so to test that this is correctly installed lets create a quick matrix to do so lets create a variable called matrix equals np.array and then we just enter a little bit of data like so where each square set of brackets is a new row in our matrix then lastly lets just print our matrix to ensure that it is working correctly by typing print our matrix variable we can see that we are printed out our matrix which is exactly what we wanted this is proof that numpy has been installed correctly we are now ready to begin coding in numpy be sure to check out our learn numpy playlist if you want to learn more about this incredible python library just some final notes if you want to leave our current python environment in the terminal just type quit to tell our python that we want to quit our current python shell and then you can use deactivate or reopen another terminal to get back to our main terminal window then to re-enter our python environment we just simply follow the steps that we took earlier like so i hope that this video helped you install numpy onto python on your mac if you enjoyed please like subscribe and consider checking out our youtube memberships by clicking the join button down below or our patreon page to support the channel however if you have any comments questions or concerns about the information i provided in this video please leave a comment down below and ill do my best to address your concerns

Shop

Learn programming in R: courses

$

Best Python online courses for 2022

$

Best laptop for Fortnite

$

Best laptop for Excel

$

Best laptop for Solidworks

$

Best laptop for Roblox

$

Best computer for crypto mining

$

Best laptop for Sims 4

$

Latest questions

NUMPYNUMPY

Common xlabel/ylabel for matplotlib subplots

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

12 answers

NUMPYNUMPY

Flake8: Ignore specific warning for entire file

12 answers

NUMPYNUMPY

glob exclude pattern

12 answers

NUMPYNUMPY

How to avoid HTTP error 429 (Too Many Requests) python

12 answers

NUMPYNUMPY

Python CSV error: line contains NULL byte

12 answers

NUMPYNUMPY

csv.Error: iterator should return strings, not bytes

12 answers

News


Wiki

Python | How to copy data from one Excel sheet to another

Common xlabel/ylabel for matplotlib subplots

Check if one list is a subset of another in Python

sin

How to specify multiple return types using type-hints

exp

Printing words vertically in Python

exp

Python Extract words from a given string

Cyclic redundancy check in Python

Finding mean, median, mode in Python without libraries

cos

Python add suffix / add prefix to strings in a list

Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

Python - Move item to the end of the list

Python - Print list vertically