我正在使用Python制作脚本以在我的博士学位中使用某些化学结构。我想为python安装openbabel库。我尽我所能,但无法在Windows上安装它。我之前发布了一个关于在Windows上安装它的问题How do I install openbabel for Python 3.6 in Windows 10?,但找不到解决方案。该解决方案安装了该库,但不起作用,无法连接到SWIG。 不,我想把它安装在我的办公室电脑上,这是一个过去5小时的mac,但我无法弄清楚发生了什么。 我试图从Opnbabel的源代码安装它,并将其与python3链接,但它造成问题。 如果我用下面的命令:如何在macOS上安装openbabel for python 3.6 Sierra 10.12.3
cmake ../ -DPYTHON_BINDINGS=ON -DRUN_SWIG=ON
它成功地将其链接到Python 2.7,我不想。当我尝试以下方法,它给了如下图所示的错误:
cmake ../ -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_BINDINGS=ON -DRUN_SWIG=ON
OR
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。 我尝试了所有与python 3.6的过程,但也发生了相同的错误。我也使用从github获得的openbabel,据说在这篇文章中使用了这些命令:http://forums.openbabel.org/OpenBabel-for-Python-3-td4659432.html 但它不起作用。 请帮助我,因为我需要这个模块来进行我的研究。 谢谢