Home » Learn Python » Modules and Packages » Installing Python Modules

Installing Python Modules

Modules in Python are files containing Python code which you can use in your program, by “importing” them.

Packages are collections of modules.

Many pre-made modules and packages are available to use in Python. You can install them using pip, the package installer for Python.

It’s best to ensure you are working in an activated virtual environment when using pip, to ensure you’re installing packages for the correct version of Python.

For example, to install numpy, the popular package for handling large arrays of numbers in Python, write the following in your terminal.

pip install numpy

Alternatively you can use:

python -m pip install numpy

Collecting numpy
  Downloading numpy-1.24.3-cp310-cp310-macosx_10_9_x86_64.whl (19.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 19.8/19.8 MB 4.3 MB/s eta 0:00:00
Installing collected packages: numpy
Successfully installed numpy-1.24.3

Leave a Reply

Blog at WordPress.com.

%d