How do I check which version of NumPy I'm using?

后端 未结 16 911
深忆病人
深忆病人 2020-12-07 08:48

How can I check which version of NumPy I\'m using?

(FYI this question has been edited because both the question and answer are not platform specific.)

相关标签:
16条回答
  • 2020-12-07 09:03

    Run:

    pip list
    

    Should generate a list of packages. Scroll through to numpy.

    ...
    nbpresent (3.0.2)
    networkx (1.11)
    nltk (3.2.2)
    nose (1.3.7)
    notebook (5.0.0)
    numba (0.32.0+0.g139e4c6.dirty)
    numexpr (2.6.2)
    numpy (1.11.3) <--
    numpydoc (0.6.0)
    odo (0.5.0)
    openpyxl (2.4.1)
    pandas (0.20.1)
    pandocfilters (1.4.1)
    ....
    
    0 讨论(0)
  • 2020-12-07 09:03

    You can also check if your version is using MKL with:

    import numpy
    numpy.show_config()
    
    0 讨论(0)
  • 2020-12-07 09:03

    We can use pip freeze to get any Python package version without opening the Python shell.

    pip freeze | grep 'numpy'
    
    0 讨论(0)
  • 2020-12-07 09:05

    If you're using NumPy from the Anaconda distribution, then you can just do:

    $ conda list | grep numpy
    numpy     1.11.3     py35_0
    

    This gives the Python version as well.


    If you want something fancy, then use numexpr

    It gives lot of information as you can see below:

    In [692]: import numexpr
    
    In [693]: numexpr.print_versions()
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    Numexpr version:   2.6.2
    NumPy version:     1.13.3
    Python version:    3.6.3 |Anaconda custom (64-bit)|
                       (default, Oct 13 2017, 12:02:49)
    [GCC 7.2.0]
    Platform:          linux-x86_64
    AMD/Intel CPU?     True
    VML available?     False
    Number of threads used by default: 8 (out of 48 detected cores)
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    
    0 讨论(0)
  • 2020-12-07 09:06

    You can try this:

    pip show numpy

    0 讨论(0)
  • 2020-12-07 09:07

    Just a slight solution change for checking the version of numpy with Python,

    import numpy as np 
    print("Numpy Version:",np.__version__)
    

    Or,

    import numpy as np
    print("Numpy Version:",np.version.version)
    

    My projects in PyCharm are currently running version

    1.17.4
    
    0 讨论(0)
提交回复
热议问题