SciPy and NumPy on Mac OS 10.6.8

I have installed Python 2.7.2 on my Mac, and it's working fine. I downloaded the binary for SciPy (http://sourceforge.net/projects/scipy/files/scipy/0.9.0/scipy-0.9.0-py2.7-python.org-macosx10.6.dmg) and NumPy (http://sourceforge.net/projects/numpy/files/NumPy/1.6.1/numpy-1.6.1-py2.7-python.org-macosx10.6.dmg) respectively, and installed them.

However, when I tried the following, error occurred:

>>> import numpy
>>> print numpy._version_

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    print numpy._version_
AttributeError: 'module' object has no attribute '_version_'

However, this works fine:

>>> numpy.version.version
'1.6.1'

Since I am new to Python, I just followed on the instructions here. I wonder what may cause the error above? Thanks.


What you are looking for is numpy.__version__ with two underscores before and after the word version. By my inderstanding, that is the convention for private (or semi-private) variables in python.

链接地址: http://www.djcxy.com/p/87168.html

上一篇: scipy安装在山狮失败

下一篇: Mac OS 10.6.8上的SciPy和NumPy