Cannot find a way to install python-dev on Mac OS X

I am trying to install psycopg2 for use with Django. I am using virtualenv, and when I try to install psycopg2, I get an error:

In file included from psycopg/psycopgmodule.c:27: ./psycopg/psycopg.h:30:10: error: 'Python.h' file not found with <angled> include; use "quotes" instead #include <Python.h> ^~~~~~~~~~ "Python.h" In file included from psycopg/psycopgmodule.c:27: In file included from ./psycopg/psycopg.h:30: psycopg/Python.h:29:10: fatal error: 'structmember.h' file not found #include <structmember.h> ^ 2 errors generated. error: command 'clang' failed with exit status 1 

I found several threads on the Internet that seemed to suggest that the solution to this problem is to install python-dev. Unfortunately, I found it only for apt-get and yum. As I know, it is not available for homegrown or maxport. Can someone help me figure out why the installation is not working or how can I get psycopg2? Thanks!

EDIT: I am using virtualenv and using the postgres application. I already have Xcode command line tools installed.

+5
source share
1 answer

So it turns out I was wrong about the cause of the problem. It's not that I did not have Python headers, it is because I somehow deleted them from the python home directory. After some communication on the Freenode Python channel, the user helped me identify the problem. IN

there were only three files:

/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/include/python2.7

So i ran

 brew uninstall python brew install python 

which reinstalled the headers and fixed the problem!

+7
source

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


All Articles