我有一个我想在板上运行的python文件。因此,我想嵌入python解释器(用C语言编写)。我设法编写了单独的运行Python文件的C项目。它编译并按我的意愿运行。下面是相同的生成文件: -在TM4c1294XL中嵌入python解释器
CC=gcc
CFLAGS=-I python3.5 -I config -I . -c -w
LDFLAGS= -lpython3.5m -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions
all: classifier trainer test link
test:
$(CC) $(CFLAGS) test.c
trainer: Trainer.c
$(CC) $(CFLAGS) Trainer.c
$(CC) Trainer.o $(LDFLAGS) -o Trainer
.ONESHELL:
classifier: Classifier.c
$(CC) $(CFLAGS) Classifier.c
# $(CC) Classifier.o $(LLFLAGS) -o Classifier
link:
$(CC) test.o Classifier.o $(LDFLAGS) -o test
clean:
rm -f Trainer.o Trainer Classifier.o Classifier
http://dpaste.com/3BCY2RE的项目我的整个目录“你好”(这是不是从例子中的一个)。
我列入 “Classifier.h” 我 “的hello.c” 和我收到以下错误:http://dpaste.com/3KKCF84
编译器的选项包括(无preincludes):
"${CG_TOOL_ROOT}/include"
"${workspace_loc:/${ProjName}/TerrainPredict}"
"${workspace_loc:/${ProjName}/TerrainPredict/config}"
"${workspace_loc:/${ProjName}/TerrainPredict/python3.5}"
"${SW_ROOT}/examples/boards/ek-tm4c1294xl"
"${SW_ROOT}"
连接文件的搜索路径:
"libc.a"
"${workspace_loc:/${ProjName}/TerrainPredict/libterrainclf.a}"
"${SW_ROOT}/driverlib/ccs/Debug/driverlib.lib"
和:
"${CG_TOOL_ROOT}/lib"
"${workspace_loc:/hello/TerrainPredict/libterrainclf.a}"
"${CG_TOOL_ROOT}/include"
我的一些配置有问题吗?或者这是python解释器的一些问题?任何帮助是极大的赞赏
编辑: - 作为@KevinDTimm建议,问题是有我的环境没有pyconfig.h。 python需要这个文件来定义重要的变量,如系统时钟源。我试图删除现有pyconfig.h
中的安全检查。我得到的第一个错误是在pytime.h
为:
"_PyTime_t need signed 64-bit integer type"
进一步是因为下面的代码块:
#ifdef PY_INT64_T
/* _PyTime_t: Python timestamp with subsecond precision. It can be used to
store a duration, and so indirectly a date (related to another date, like
UNIX epoch). */
typedef PY_INT64_T _PyTime_t;
#define _PyTime_MIN PY_LLONG_MIN
#define _PyTime_MAX PY_LLONG_MAX
#else
# error "_PyTime_t need signed 64-bit integer type"
#endif
在我看来,它需要一个用来存储时间的变量。我需要帮助分配该变量。
我想出了同一时间!如何获得TI板卡的pyconfig.h?有没有需要它的工作?如何写一个必须的? –
对不起,但我没有答案 - 我知道问题是什么,但不是详细的解决方案 – KevinDTimm