oracle提示找不到oci,cx_Oracle pip安装失败:oci.h:没有这样的文件或目录
正如bschulz所解释的,这个问题通常是通过设置ORACLE_HOME和LD_LIBRARY_PATH环境变量来解决的,以确保gcc可以访问头文件。
在我的例子中,它并没有解决问题,但是检查错误的痕迹给了我解决问题的提示。
执行pip install cx_Oracle时显示以下错误:gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/home/oracle/product/12.1.0/rdbms/demo -I/home/oracle/product/12.1.0/rdbms/public -I/usr/include/python2.7 -c cx_Oracle.c -o build/temp.linux-x86_64-2.7-12c/cx_Oracle.o -DBUILD_VERSION=5.2.1
cx_Oracle.c:10:17: error: oci.h: No such file or directory
cx_Oracle.c:11:18: error: orid.h: No such file or directory
cx_Oracle.c:27:2: error: #error Unsupported version of OCI.
在man gcc中查找-I标志:-I dir Add the directory dir to the list of directories to be searched for header files. ....
所以问题在于这些标志值:-I/home/oracle/product/12.1.0/rdbms/demo
-I/home/oracle/product/12.1.0/rdbms/public
-I/usr/include/python2.7
我真的不知道为什么-I标志被设置为这些值,但是让它起作用的简单方法是修改从pip命令行传递正确值的标志:pip install cx_Oracle --global-option=build_ext --global-option="-I/home/oracle/instantclient_12_1/sdk/include"
这样,一个新的-I值被发送到gcc,安装正确结束。
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)