0

有人可以逐步介绍如何在 linux 环境中安装剪辑和 clipspy。pip install clipspy对我不起作用,因为我的组织中不允许使用 pip。我需要从源代码构建。

我试过python setup.py install了,clipspy-0.3.0但编译终止了。

gcc -pthread -B /anaconda3/compiler_compat -Wl,--sysroot=/ -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes /clips_core_source_630/core/ -fPIC -Ic -Itmpclips_core_source_630core -I/anaconda3/include/python3.6m -c build/temp.linux-x86_64-3.6/_clips.c -o build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6/_clips.o
build/temp.linux-x86_64-3.6/_clips.c:523:19: fatal error: clips.h: No such file or directory
 #include <clips.h>
                   ^
compilation terminated.

我知道我必须安装 clips_6.30 但 src 代码中有很多 make 文件

clips_core_source_630/makefiles> ls

makefile.g++ makefile.gcc makefile.lib makefile.lib++ makefile.win

我没有c/c++技术经验,也无法理解clips_core_source_630.

4

1 回答 1

2

您可以查看clipspy travis 安装脚本以获取参考示例。

提取 CLIPS 存档后,您可以将文件复制makefile.lib到源文件夹中。

然后,您需要稍微修改 Makefile 以将 CLIPS 构建为共享库。为此,请将-fPIC标志添加到gcc编译命令。这将生成几个.o适合包含在库中的文件。

使用make命令构建源。然后,您可以将目标文件链接在一起以生成库文件。

ld -G *.o -o libclips.so

完成后,您可以构建和安装clipspy,确保您拥有最新的cffiPythonsetuptools模块。

python setup.py build_ext --include-dirs <clips_dir>/core/ --library-dirs <clips_dir>/core/
python setup.py install
于 2018-12-26T10:12:52.900 回答