w3resource

NumPy: Get the numpy version and show numpy build configuration

NumPy: Basic Exercise-1 with Solution

Write a Numpy program to get the Numpy version and show the Numpy build configuration.

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())

Sample 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:

Previous: NumPy Exercises Home.
Next: NumPy program to get help on the add function.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Follow us on Facebook and Twitter for latest update.