numpy.lib.NumpyVersion — NumPy v1.11 Manual (original) (raw)

class numpy.lib.NumpyVersion(vstring)[source]

Parse and compare numpy version strings.

Numpy has the following versioning scheme (numbers given are examples; they can be > 9) in principle):

Comparing needs to be done against a valid version string or otherNumpyVersion instance. Note that all development versions of the same (pre-)release compare equal.

New in version 1.9.0.

Parameters: vstring : str Numpy version string (np.__version__).

Examples

from numpy.lib import NumpyVersion if NumpyVersion(np.version) < '1.7.0'): ... print('skip') skip

NumpyVersion('1.7') # raises ValueError, add ".0"