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

后端 未结 16 913
深忆病人
深忆病人 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:12

    For Python 3.X print syntax:

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

    Or

    python -c "import numpy; print(numpy.__version__)"
    
    0 讨论(0)
  • 2020-12-07 09:13
    import numpy
    print numpy.__version__
    
    0 讨论(0)
  • 2020-12-07 09:13

    It is good to know the version of numpy you run, but strictly speaking if you just need to have specific version on your system you can write like this:

    pip install numpy==1.14.3 and this will install the version you need and uninstall other versions of numpy.

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

    From the command line, you can simply issue:

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

    Or:

    python -c "import numpy; print(numpy.__version__)"
    
    0 讨论(0)
  • 2020-12-07 09:16

    In a Python shell:

    >>> help()
    help> numpy
    
    0 讨论(0)
  • 2020-12-07 09:20

    Simply

    pip show numpy
    

    and for pip3

    pip3 show numpy
    

    Works on both windows and linux. Should work on mac too if you are using pip.

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