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

后端 未结 16 912
深忆病人
深忆病人 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:24
    import numpy
    numpy.version.version
    
    0 讨论(0)
  • 2020-12-07 09:24
    >> import numpy
    >> print numpy.__version__
    
    0 讨论(0)
  • 2020-12-07 09:24

    You can get numpy version using Terminal or a Python code.

    In a Terminal (bash) using Ubuntu:

    pip list | grep numpy
    

    In python 3.6.7, this code shows the numpy version:

    import numpy
    print (numpy.version.version)
    

    If you insert this code in the file shownumpy.py, you can compile it:

    python shownumpy.py
    

    or

    python3 shownumpy.py
    

    I've got this output:

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

    Pure Python line that can be executed from the terminal (both 2.X and 3.X versions):

    python -c "import numpy; print(numpy.version.version)"
    

    If you are already inside Python, then:

    import numpy
    print(numpy.version.version)
    
    0 讨论(0)
提交回复
热议问题