![](/img/trans.png)
[英]How to Install openbabel for Python 3.6 on macOS Sierra 10.12.3
[英]How do I install openbabel for Python 3.6 in Windows 10?
我正在使用Python編寫腳本來處理博士學位中的某些化學結構。 我想為python安裝openbabel庫。 我已盡力而為,但無法安裝。 它總是給出錯誤: Error: SWIG failed. Is Open Babel installed?
Error: SWIG failed. Is Open Babel installed?
這是我PC上的Python路徑: C:\\Users\\malih\\AppData\\Local\\Programs\\Python\\Python36-32
。 Openbabel安裝在以下路徑C:\\Program Files (x86)\\OpenBabel-2.3.1
。
當我運行python -m pip install openbabel
,出現以下錯誤:
C:\Users\malih>python -m pip install openbabel
Collecting openbabel
Using cached openbabel-2.4.1.tar.gz
Installing collected packages: openbabel
Running setup.py install for openbabel ... error
Complete output from command C:\Users\malih\AppData\Local\Programs\Python\Python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\malih\\AppData\\Local\\Temp\\pip-build-glr82a7x\\openbabel\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\malih\AppData\Local\Temp\pip-02z3p_a9-record\install-record.txt --single-version-externally-managed --compile:
running install
running build_ext
Warning: pkg-config could not be found.
Guessing Open Babel location:
- include_dirs: ['C:\\Users\\malih\\AppData\\Local\\Programs\\Python\\Python36-32\\include', 'C:\\Users\\malih\\AppData\\Local\\Programs\\Python\\Python36-32\\include', '/usr/local/include/openbabel-2.0']
- library_dirs: ['C:\\Users\\malih\\AppData\\Local\\Programs\\Python\\Python36-32\\libs', 'C:\\Users\\malih\\AppData\\Local\\Programs\\Python\\Python36-32\\PCbuild\\win32', '/usr/local/lib']
building '_openbabel' extension
swigging openbabel-python.i to openbabel-python_wrap.cpp
swig.exe -python -c++ -small -O -templatereduce -naturalvar -IC:\Users\malih\AppData\Local\Programs\Python\Python36-32\include -IC:\Users\malih\AppData\Local\Programs\Python\Python36-32\include -I/usr/local/include/openbabel-2.0 -o openbabel-python_wrap.cpp openbabel-python.i
Error: SWIG failed. Is Open Babel installed?
You may need to manually specify the location of Open Babel include and library directories. For example:
python setup.py build_ext -I/usr/local/include/openbabel-2.0 -L/usr/local/lib
python setup.py install
----------------------------------------
Command "C:\Users\malih\AppData\Local\Programs\Python\Python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\malih\\AppData\\Local\\Temp\\pip-build-glr82a7x\\openbabel\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\malih\AppData\Local\Temp\pip-02z3p_a9-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\malih\AppData\Local\Temp\pip-build-glr82a7x\openbabel\
我嘗試按照此頁面上的說明進行操作,但它們僅適用於linux,而對於Windows無法遵循它們: 如何在Travis CI中使用python-openbabel?
我還嘗試根據以下指南安裝pkg-config,但即使那樣,它也會出現相同的錯誤: 如何在Windows中安裝pkg-config?
請為我提供幫助,因為我的工作是基於此的,因此我被困在這一點上。 在此先感謝您的時間。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.