Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trouble installing scipy with macports

I'm new to programming and trying to import scipy.

Problem:

When I try to import scipy in the python interpreter in terminal, it looks like this:

[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named scipy
>>> 

I seem to have installed macports correctly. I can successfully import numpy the same way as above.

I originally installed scipy as per "macports" instructions on http://www.scipy.org/install.html

ie:

sudo port install py27-numpy py27-scipy py27-matplotlib py27-ipython +notebook py27-pandas py27-sympy py27-nose

Also I followed this post: Python will not recognize MacPorts installed packages

but could not seem to derive an answer for myself

To clarify:

When I run "which python" i get

/usr/bin/python

When I run "port contents py27-packagename" I get

Port py27-packagename is not installed.

Thanks in advance

like image 559
Sammy Avatar asked Dec 16 '22 07:12

Sammy


1 Answers

MacPorts does not touch the system python when installing python modules. It does install these modules for its own version of python, which is in /opt/local/bin/python2.7 by default. You can make it the default python to be run when you type python in your shell using sudo port select --set python python27.

like image 106
neverpanic Avatar answered Jan 14 '23 13:01

neverpanic