下載最新版本的VTK的(7.0.0)從vtk.org的tar.gz文件後,我做了一個build文件夾,運行ccmake,標誌設置爲Python3.5,設置標誌PYTHON_WRAPPING打開並運行make,然後進行make install。然後,我做了一個問題安裝VTK
>>> import vtk
我得到了以下錯誤:
In [1]: import vtk
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/vtk/vtkCommonCore.py in <module>()
4 # use relative import for installed modules
----> 5 from .vtkCommonCorePython import *
6 except ImportError:
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/vtk/vtkCommonCorePython.so, 2): Library not loaded: libvtkCommonCorePython35D-7.0.1.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/vtk/vtkCommonCorePython.so
Reason: image not found
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
<ipython-input-1-b7e11aadda62> in <module>()
----> 1 import vtk
/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/vtk/__init__.py in <module>()
39
40 # --------------------------------------
---> 41 from .vtkCommonCore import *
42 from .vtkCommonMath import *
43 from .vtkCommonMisc import *
/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/vtk/vtkCommonCore.py in <module>()
7 # during build and testing, the modules will be elsewhere,
8 # e.g. in lib directory or Release/Debug config directories
----> 9 from vtkCommonCorePython import *
ImportError: No module named 'vtkCommonCorePython'
任何想法,這可能是爲什麼發生?
你有Python的3.5安裝?我猜測默認的Python版本是2.7,否則你必須設置比PYTHON_WRAPPING更多的變量。 –
爲Python 3.5安裝VTK是一場完全的噩夢。它的每一部分都是你正確的,另一部分則向你拋出一些東西。我有完全相同的問題。讓我們知道您是否找到了解決方法。 – Pouria