Pip3 cannot find Python.h when installing numpy on OS X

My operating system is OSX 10.10.4, and I have both python2.7.10 and python3.5, and tried to install numpy, scipy and matplotlib for both of these two versions of python.

In python2, everything went well, but as for python3, I tried installing numpy with the command

pip3 install numpy

Then it turned out that the installation was completed because of this, it cannot find the Python.h file. But actually the python.h file exists in the python3.5 directory. Therefore, I am now completely embarrassed.

September 18th update, exact error messages: first he tried to create numpy:

  compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -Inumpy/core/include -c'
  clang: _configtest.c
  _configtest.c:1:10: fatal error: 'Python.h' file not found
  #include <Python.h>
         ^
  1 error generated.
  _configtest.c:1:10: fatal error: 'Python.h' file not found
  #include <Python.h>
       ^
  1 error generated.
  failure.
  removing: _configtest.c _configtest.o
  Running from numpy source directory.
  /usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'define_macros'
  warnings.warn(msg)
  .....
File "numpy/core/setup.py", line 293, in check_types
  "Cannot compile 'Python.h'. Perhaps you need to "\
SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.

----------------------------------------
Failed building wheel for numpy
Failed to build numpy

and then the installation reported the same error.

+4
source share
1 answer

Python OSX . :

xcode-select --install, .

0

Source: https://habr.com/ru/post/1607859/


All Articles