دليل الدخول إلى NumPy
- Previous Page مقدمة إلى NumPy
- Next Page إنشاء مصفوفات NumPy
Install NumPy
If you have already installed Python and PIPThen, installing NumPy is very easy.
Please use this command to install it:
C:\Users\Your Name>pip install numpy
If this command fails, please use a python distribution that has already installed NumPy, such as Anaconda, Spyder, etc.
Import NumPy
After installing NumPy, add import
Keyword to import it into your application:
import numpy
Now, Numpy has been imported and can be used.
Example
import numpy arr = numpy.array([1, 2, 3, 4, 5]) print(arr)
NumPy as np
NumPy is usually called np
Alias Import.
Alias: In Python, an alias is an alternative name used to refer to the same thing.
Please use alias when importing as
Keyword to create alias:
import numpy as np
Now, NumPy package can be called np
instead of numpy
.
Example
import numpy as np arr = np.array([1, 2, 3, 4, 5]) print(arr)
Check NumPy Version
The version string is stored in __version__
in properties.
Example
import numpy as np print(np.__version__)
- Previous Page مقدمة إلى NumPy
- Next Page إنشاء مصفوفات NumPy