0

I'm trying to compile C++ code for a Python3 extension on macOS, and I'm only able to compile if I #include "$HOME/anaconda3/include/python3.6m/Python.h. Is there a way to #include <Python/Python.h> and have the "include" refer to the anaconda Python.h instead of the system Python.h?

1 Answer 1

1

Having your Python.h inside a directory named python3.6m makes it a bit awkward, but here are two possible ways to resolve the issue:

  1. Rename the directory from python3.6m to Python, and then add the argument -I$HOME/anaconda3/include to your compile line, to tell the compiler to resolve include-paths starting at that folder.

  2. Alternatively, you could add a symlink so that the python3.6m directory can be accessed via two different names, e.g.:

    cd ~/anaconda3/include ; ln -s python3.6m Python

... and then add the argument -I$HOME/anaconda3/include to your compiler arguments (same as in step 1)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.