I am creating a Python module using C, though when I use #include <Python.h>
it says that it find this file, even though I have added it to the user PATH
variable.
If I use #include "C:/Users/<my user>/AppData/Local/Programs/Python/Python38/include/Python.h"
it works on my PC, though this leads to errors when importing via PyPi, so I would like the first method to work.
Any ideas as to how I can fix this would be greatly appreciated!
I don't know of any compilers that use PATH
to find include files. Instead, they use a separate environment variable such as C_INCLUDE_PATH
. You need to find the correct environment variable to set.
You can almost certainly set this in CLion's settings somewhere, either globally or for the specific project. Check out their help file: https://www.jetbrains.com/help/clion/managing-included-files.html and https://www.jetbrains.com/help/clion/absolute-path-variables.html
Alternatively, all compilers have a command-line option to specify the include search path. For gcc
, use -I
.