如何检查我使用的是哪个版本的Numpy ?

时间:2022-07-14 07:15:09

How can I check which version of NumPy I'm using? I'm using Mac OS X 10.6.1 Snow Leopard.

如何检查使用的是哪个版本的NumPy ?我用的是Mac OS X 10.6.1雪豹。

12 个解决方案

#1


272  

import numpy
numpy.version.version

#2


172  

>> import numpy
>> print numpy.__version__

#3


39  

from the command line, you can simply issue:

从命令行,您可以简单地发出:

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

or

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

#4


15  

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

你也可以检查你的版本是否使用MKL:

import numpy
numpy.show_config()

#5


7  

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

我们可以使用pip冻结来获得任何python包版本,而无需打开python shell。

pip freeze | grep 'numpy'

pip冷冻| grep 'numpy'

#6


6  

Run:

运行:

pip list

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

应该生成包的列表。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)
....

#7


3  

You can try this:

你可以试试这个:

pip show numpy

皮普显示numpy

#8


3  

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

如果你用的是Anaconda分布的Numpy,你可以这样做:

$ conda list | grep numpy
numpy     1.11.3     py35_0

This gives the Python version as well.

这也提供了Python版本。


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

#9


2  

For python 3.X print syntax.

python 3。X打印语法。

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

or

python -c "import numpy; print numpy.__version__"

#10


1  

import numpy
print numpy.__version__

#11


1  

In a python shell:

在python shell:

>>> help()
help> numpy

#12


-6  

numpy.version.version

type it.

类型。

#1


272  

import numpy
numpy.version.version

#2


172  

>> import numpy
>> print numpy.__version__

#3


39  

from the command line, you can simply issue:

从命令行,您可以简单地发出:

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

or

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

#4


15  

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

你也可以检查你的版本是否使用MKL:

import numpy
numpy.show_config()

#5


7  

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

我们可以使用pip冻结来获得任何python包版本,而无需打开python shell。

pip freeze | grep 'numpy'

pip冷冻| grep 'numpy'

#6


6  

Run:

运行:

pip list

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

应该生成包的列表。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)
....

#7


3  

You can try this:

你可以试试这个:

pip show numpy

皮普显示numpy

#8


3  

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

如果你用的是Anaconda分布的Numpy,你可以这样做:

$ conda list | grep numpy
numpy     1.11.3     py35_0

This gives the Python version as well.

这也提供了Python版本。


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

#9


2  

For python 3.X print syntax.

python 3。X打印语法。

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

or

python -c "import numpy; print numpy.__version__"

#10


1  

import numpy
print numpy.__version__

#11


1  

In a python shell:

在python shell:

>>> help()
help> numpy

#12


-6  

numpy.version.version

type it.

类型。