SoFunction
Updated on 2024-10-29

A brief tutorial on installing and using the Numpy package in Python.

This article example describes the installation and use of the Numpy package in Python. Shared for your reference, as follows:

Numpy package installation

preliminary

1. Python installation

2. pip install (e.g., using the pip install command:pip install numpy

3. Add the folder where pip is located to the path path environment variable.

4. Download the appropriate Numpy installation package in .whl format.download link.

Once the above preparations are ready, proceed with the Numpy installation, first entering the directory where the whl installer is stored. For example, in the C disk:

cd C:\

Then use the command line to install it:

pip install numpyfilename.whl

Notes:Common whl format installers can be downloaded here:/~gohlke/pythonlibs/#numpy

At this point, the installation of Numpy is complete.

Examples of Numpy Usage

import numpy as np
print (4,4)

The resulting output is a random 4×4 matrix

[[ 0.75114926  0.6040328   0.13198258  0.29492663]
 [ 0.43678263  0.68013402  0.2164971   0.4187556 ]
 [ 0.72379313  0.11051623  0.02170234  0.4306268 ]
 [ 0.16435613  0.7931435   0.93938908  0.78719936]]

Proof that Numpy was successfully imported and is available.

Readers interested in more Python related content can check out this site's topic: theSummary of Python array manipulation techniques》、《Summary of Python mathematical operations techniques》、《Python Data Structures and Algorithms Tutorial》、《Summary of Python function usage tips》、《Summary of Python string manipulation techniques》、《Python introductory and advanced classic tutorialsand theSummary of Python file and directory manipulation techniques

I hope that what I have said in this article will help you in Python programming.