我使用Python来制作脚本来处理PhD中的一些化学结构。我想为python安装openbabel库。我尽力了,但我无法在Windows上安装它。早些时候,我在How do I install openbabel for Python 3.6 in Windows 10?上发布了一个关于在Windows上安装它的问题,但没有找到解决方案。解决方案安装了库,但无法工作,无法连接到SWIG。不,我正试着把它安装在我的办公室电脑上,这台电脑过去5个小时都是mac电脑,但是我不知道发生了什么。我试着从Opnbabel的源代码安装它,并将它与python3链接起来,但它造成了问题。如果我使用以下命令:
cmake ../ -DPYTHON_BINDINGS=ON -DRUN_SWIG=ON
它成功地将它链接到Python2.7,我不想要它。当我尝试以下选项时,它会给出如下错误:
cmake ../ -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_BINDINGS=ON -DRUN_SWIG=ON
或
cmake ../ -DRUN_SWIG=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_INCLUDE_DIR=/Library/Frameworks/Python.framework/Versions/3.5/include/python3.5m -DPYTHON_LIBRARY=/Library/Frameworks/Python.framework/Versions/3.5/lib/libpython3.5m.dylib -DPYTHON_BINDINGS=ON
在大量成功的输出之后,它在结束时给出了以下错误:
-- Found PythonInterp: /usr/bin/python3.6 (found version "1.4")
-- Found SWIG: /usr/local/bin/swig (found version "3.0.12")
-- Found SWIG: /usr/local/bin/swig (found suitable version "3.0.12", minimum required is "2.0")
-- Found PythonLibs: /usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/libpython3.6m.dylib (found version "3.6.0")
-- Python bindings will be compiled
CMake Error at scripts/CMakeLists.txt:120 (install):
install TARGETS given no LIBRARY DESTINATION for module target
"bindings_python".
CMake Error at scripts/CMakeLists.txt:123 (install):
install FILES given no DESTINATION!
CMake Error at scripts/CMakeLists.txt:126 (install):
install FILES given no DESTINATION!
-- Configuring incomplete, errors occurred!
See also "/usr/local/Cellar/obabel/openbabel-master/ali/CMakeFiles/CMakeOutput.log".
See also "/usr/local/Cellar/obabel/openbabel-master/ali/CMakeFiles/CMakeError.log".我不知道为什么它会将Python检测为v1.4 -- Found PythonInterp: /usr/bin/python3.6 (found version "1.4"),而不是查找v.3.5。我也尝试了python3.6的所有过程,但是同样的错误也会发生。我还使用了从github获得的openbabel,据说它在下面的帖子中使用这些命令:http://forums.openbabel.org/OpenBabel-for-Python-3-td4659432.html,但它也不起作用。请帮助我,因为我需要这个模块为我的研究。谢谢
发布于 2017-02-20 00:18:35
我找到了解决办法。以下是详细的解决方案:
cmake ../ -DPYTHON_EXECUTABLE=/Library/Frameworks/Python.framework/Versions/3.5/bin/python3 -DPYTHON_BINDINGS=ON -DRUN_SWIG=ON
在上面的命令中,“-DPYTHON_EXECUTABLE”开关告诉它找到Python3解释器的路径。你可以在终端用which python3检查它。makemake install全部完成!:)
https://stackoverflow.com/questions/42195236
复制相似问题