Reputation: 33293
I am trying to install numpy on my mac machine. Whatever I try, I end up getting this error when trying to run my python code
import numpy as np
File "/Library/Python/2.6/site-packages/numpy-2.0.0.dev_26aa3cf_20110808-py2.7-macosx-
10.7-x86_64.egg/numpy/__init__.py", line 137, in <module>
import add_newdocs
File "/Library/Python/2.6/site-packages/numpy-2.0.0.dev_26aa3cf_20110808-py2.7-macosx-
10.7-x86_64.egg/numpy/add_newdocs.py", line 9, in <module>
from numpy.lib import add_newdoc
File "/Library/Python/2.6/site-packages/numpy-2.0.0.dev_26aa3cf_20110808-py2.7-macosx-
10.7-x86_64.egg/numpy/lib/__init__.py", line 4, in <module>
from type_check import *
File "/Library/Python/2.6/site-packages/numpy-2.0.0.dev_26aa3cf_20110808-py2.7-macosx-
10.7-x86_64.egg/numpy/lib/type_check.py", line 8, in <module>
import numpy.core.numeric as _nx
File "/Library/Python/2.6/site-packages/numpy-2.0.0.dev_26aa3cf_20110808-py2.7-macosx-
10.7-x86_64.egg/numpy/core/__init__.py", line 5, in <module>
import multiarray
ImportError: dlopen(/Library/Python/2.6/site-packages/numpy-2.0.0.dev_26aa3cf_20110808-py2.7-
macosx-10.7-x86_64.egg/numpy/core/multiarray.so, 2): Symbol not found: _PyCapsule_Import
Referenced from: /Library/Python/2.6/site-packages/numpy-2.0.0.dev_26aa3cf_20110808-py2.7-macosx-10.7-x86_64.egg/numpy/core/multiarray.so
Expected in: flat namespace
in /Library/Python/2.6/site-packages/numpy-2.0.0.dev_26aa3cf_20110808-py2.7-macosx-
10.7-x86_64.egg/numpy/core/multiarray.so
Also when I enter Python in my terminal it takes me to python 2.6.1 version. How do I solve this?
Upvotes: 1
Views: 2177
Reputation: 3090
If you want a fairly complete scientific python environment on your Mac I would recommend the EPD free Python distribution. That will give you numpy and scipy among others.
Upvotes: 0
Reputation: 25052
Based on the paths in the error message, it looks like you intended to install Numpy for a Python 2.7 that you've already installed. You're getting Python 2.6 instead. This suggests a problem with your PATH
environment variable. Adjust the PATH
variable in your .bash_profile
so that the executables for the Python 2.7 appear before the system versions in /usr/bin
.
Upvotes: 2
Reputation: 24328
I would recommend using macports or fink as a package system.
With macports, installing numpy is as easy as
cd /opt/local/bin
sudo ./port install py27-numpy
where py27 may be replaced with your favorite python version.
Upvotes: 1