我试图用自制软件安装vtk,但是,现在当我在Python上使用import vtk时,我的python会话中止了……
我在MacOSX上工作,我做了这样的事情:
brew install vtk --with-qt --with-python --with-pyqt它返回:
....
[ 29%] Built target vtkFiltersCore
make: *** [all] Error 2
READ THIS: https://git.io/brew-troubleshooting
If reporting this issue please do so at (not Homebrew/brew):
https://github.com/Homebrew/homebrew-science/issues
....在那之后,我读到我应该使用这句话:
HOMEBREW_MAKE_JOBS=1 VERBOSE=1 brew install vtk --qt --python --pyqt很长一段时间后,它会返回:
....
==> Caveats
Even without the --with-qt option, you can display native VTK render windows
from python. Alternatively, you can integrate the RenderWindowInteractor
in PyQt, PySide, Tk or Wx at runtime. Read more:
import vtk.qt4; help(vtk.qt4) or import vtk.wx; help(vtk.wx)
Python modules have been installed and Homebrew's site-packages is not
in your Python sys.path, so you will not be able to import the modules
this formula installed. If you plan to develop with these modules,
please run:
mkdir -p /Users/TheUser/Library/Python/2.7/lib/python/site-packages
echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/TheUser/Library/Python/2.7/lib/python/site-packages/homebrew.pth
==> Summary
/usr/local/Cellar/vtk/7.0.0_3: 3,203 files, 107.7M所以我运行了mkdir & echo行
当我在Python控制台中尝试import vtk时,它返回:
Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6我稍后重新尝试重新安装它:
==> Installing vtk from homebrew/science
Error: vtk-7.0.0_3 already installed
To install this version, first `brew unlink vtk`所以我解除了链接,并重新运行了HOMEBREW_MAKE_JOBS=1 VERBOSE=1 brew install vtk --qt --python --pyqt。
结果是:
==> Patching VTK to use system Python 2
==> Caveats
Even without the --with-qt option, you can display native VTK render windows from python. Alternatively, you can integrate the RenderWindowInteractor in PyQt, PySide, Tk or Wx at runtime. Read more:
import vtk.qt4; help(vtk.qt4) or import vtk.wx; help(vtk.wx)
VTK was linked against your system copy of Python.
If you later decide to change Python installations, relink VTK with:
brew postinstall vtk
==> Summary
/usr/local/Cellar/vtk/7.0.0_5: 3,204 files, 107.7M当我在python控制台上使用import vtk时:中止!
我怎么才能修复它呢?
发布于 2016-10-14 00:51:45
我目前正在更新到vtk/7.0.0_5 (之前使用过7.0.0_3 ),我用来安装它的代码行是:
brew install vtk --with-qt --with-qt5 --with-python 我在python (2.7)中使用它时没有遇到任何问题。
好了--所以刚刚完成了对7.0.0_5的升级,我收到了同样的信息,谢谢。但是启动python和启动完全没有问题:
> $ python
Python 2.7.12 (default, Oct 11 2016, 05:20:59)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import vtk
>>> import vtk.qt4希望能帮上忙,
斯蒂芬
https://stackoverflow.com/questions/40025812
复制相似问题