Pycharm cannot import numpy

My system is Mac OS X. First I installed numpy via macport and then downloaded Pycharm and found that any interpreter I choose could not import numpy. The results are as follows:

/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 "/Users/erleye/Documents/Python/Pycharm Projects/test.py"
Traceback (most recent call last):
  File "/Users/erleye/Documents/Python/Pycharm Projects/test.py", line 4, in <module>
    import numpy as np
ImportError: No module named numpy

But if I use python test.pyin the terminal, it works fine. When I type which -a pythonin the terminal, I have:

/opt/local/bin/python
/opt/local/bin/python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
/usr/local/bin/python
/usr/bin/python
/opt/local/bin/python

I don’t know why I have so many versions of python, but I’m sure that when I selected the interpreter in Pycharm, it is the one that has numpy installed. What can I do?

+4
source share
1 answer

, python, , Pycharm, , numpy.

, .

which, Python, python python.py , /opt/local/bin/python, MacPorts one.

PyCharm, Python, /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7, MacPorts. (, Python.org.)

, .

, , MacPorts Python, - PYTHONPATH PYTHONHOME, Python.org , ...

, , 3 Python 2.7, 6 , , , . , , , .

+2

All Articles