py icon indicating copy to clipboard operation
py copied to clipboard

Using brew Python in OSX

Open chaosct opened this issue 8 years ago • 1 comments

I had to modify some parts of the gnumake-mac-gcc.inc in order to compile against an alternative Python installation (from brew). I'll put them here so it can serve as documentation to anyone having the same problem.

@@ -1,8 +1,8 @@
 # don't use -framework Python, since this will stick to the default system version

-_LOCAL_FRAMEWORK := /Library/Frameworks/Python.framework/Versions/$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)
+_LOCAL_FRAMEWORK := /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework
 _SYSTEM_FRAMEWORK := /System/Library/Frameworks/Python.framework/Versions/$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)
 _LOCAL_LIBRARY := /Library/Python/$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)
 _SYSTEM_LIBRARY := /System/Library/Python/$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)

 DEFS += -DPY_EXPORTS
@@ -19,11 +19,11 @@ endif
 ifdef PY_NUMARRAY
 DEFS += -DPY_NUMARRAY
 endif
 ifdef PY_NUMPY
 DEFS += -DPY_NUMPY
-INCPATH += -I$(_LOCAL_LIBRARY)/python$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)/site-packages/numpy/core/include
+INCPATH += -I/usr/local/lib/python2.7/site-packages/numpy/core/include
 ifeq ($(PY_DEFAULT),1)
 INCPATH += -I$(_SYSTEM_FRAMEWORK)/lib/python$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)/site-packages/numpy/core/include
 INCPATH += -I$(_SYSTEM_FRAMEWORK)/Extras/lib/python/numpy/core/include
 else
 INCPATH += -I$(_LOCAL_FRAMEWORK)/lib/python$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)/site-packages/numpy/core/include

It would be awesome if this could be configured in config.txt.

chaosct avatar Apr 07 '16 10:04 chaosct

Thank you, your input is much appreciated. I'll think of how to make the build system more flexible.

grrrr avatar Apr 07 '16 20:04 grrrr