NumPy: Get the numpy version and show numpy build configuration
Get NumPy Version & Build Info
Write a Numpy program to get the Numpy version and show the Numpy build configuration.
This problem involves using NumPy to retrieve information about the library itself. The task is to write a program that displays the installed NumPy version and shows the build configuration details. This information is useful for debugging, ensuring compatibility, and understanding how NumPy was compiled and set up on the system.
Sample Solution :
Python Code :
# Importing the NumPy library with an alias 'np'
import numpy as np
# Printing the version of NumPy installed
print(np.__version__)
# Printing the configuration details of NumPy
print(np.show_config())
Output:
lapack_opt_info: library_dirs = ['C:\\projects\\numpy-wheels\\numpy\\build\\openblas'] define_macros = [('HAVE_CBLAS', None)] libraries = ['openblas'] language = f77 blis_info: NOT AVAILABLE blas_opt_info: library_dirs = ['C:\\projects\\numpy-wheels\\numpy\\build\\openblas'] define_macros = [('HAVE_CBLAS', None)] libraries = ['openblas'] language = f77 openblas_lapack_info: library_dirs = ['C:\\projects\\numpy-wheels\\numpy\\build\\openblas'] define_macros = [('HAVE_CBLAS', None)] libraries = ['openblas'] language = f77 openblas_info: library_dirs = ['C:\\projects\\numpy-wheels\\numpy\\build\\openblas'] define_macros = [('HAVE_CBLAS', None)] libraries = ['openblas'] language = f77 blas_mkl_info: NOT AVAILABLE lapack_mkl_info: NOT AVAILABLE None
Explanation:
In the above code –
print(np.__version__): This line prints the version number of the NumPy library being used. The __version__ attribute is a string that contains the library's version information.
print(np.show_config()): This line prints the configuration information of the NumPy library.
Python-Numpy Code Editor:
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics