[MacPorts] #51655: py-numpy: Could not import numpy into python 2.7

MacPorts noreply at macports.org
Fri Jun 17 09:57:03 PDT 2016


#51655: py-numpy: Could not import numpy into python 2.7
-------------------------------+-------------------
  Reporter:  mahajan.smriti@…  |      Owner:  dh@…
      Type:  defect            |     Status:  new
  Priority:  Normal            |  Milestone:
 Component:  ports             |    Version:  2.3.4
Resolution:                    |   Keywords:
      Port:  py-numpy          |
-------------------------------+-------------------

Comment (by mahajan.smriti@…):

 Replying to [comment:1 ryandesign@…]:
 > Replying to [ticket:51655 mahajan.smriti@…]:
 > >
 > > Following https://astrofrog.github.io/macports-python/ I installed
 Python, numpy, scipy and matplotlib and configured as directed in the
 link.
 > > But when I try to import numpy as a module I get the error
 "ImportError: No module named numpy".
 > > Instead if I try using py27-numpy, then I get a syntax error. While
 "which python returns
 "/Library/Frameworks/Python.framework/Versions/2.7/bin/python", "which
 numpy" and "which py27-numpy" give no output.
 >
 > It is normal that `which numpy` and `which py27-numpy` would return no
 output, because there are no executables by those names. numpy is a python
 module, not an executable program.
 >
 > /Library/Frameworks/Python.framework/Versions/2.7/bin/python is not
 MacPorts python; it's some other python you have installed outside of
 MacPorts. It will have no knowledge of python modules you install with
 MacPorts. To use MacPorts python modules, you must use MacPorts python,
 which is /opt/local/bin/python2.7. You can either run it by that absolute
 path, or if you want to be able to run it by just typing "python", then
 you can first run `sudo port select python python27` and then close and
 reopen your terminal window.

 Thank you! That has got it working. However, the sudo command did not work
 for me and I instead had to add an alias in my .profile file to use the
 correct file path to run "python".

-- 
Ticket URL: <https://trac.macports.org/ticket/51655#comment:2>
MacPorts <https://www.macports.org/>
Ports system for OS X


More information about the macports-tickets mailing list