无法使用 Anaconda 安装 VTK

Can not install VTK with Anaconda

我无法在 Mac OS X 中通过 anaconda 安装 VTK。我使用

conda install -c anaconda vtk=6.3.0

Python 2.7 但是出现如下错误:

UnsatisfiableError: The following specifications were found to be in conflict: - python 3.6* - vtk 6.3.0* -> python 2.7* -> openssl 1.0.1* Use "conda info " to see the dependencies for each package.

但是我已经把Python更新到3.6了,还是一样的错误。

帮我试试这个:

conda create --name vtk_test python=2.7 vtk

这将创建一个包含 VTK、Python 及其依赖项的新环境。

我建议直接从 wheel 文件安装。您可以从这里 (wheel file directory site) 获取 VTK wheel 文件。这个网站几乎有每个车轮文件,所以它是你的朋友!只要搜索它,你就会看到一堆 .whl VTK 文件。

只需下载与您的 anaconda python 根版本(3.5、3.6、2.7 等)和 32 位或 64 位(取决于您的 python 版本)相匹配的 wheel 文件。

要从 wheel 文件安装,请在 wheel 所在的目录中打开终端并键入

pip install "your_wheel_file_name"

如果你想为conda环境安装它,只需先激活环境(activate "env_name"),然后从wheel文件安装。

Conda 搜索

$ conda search vtk
Fetching package metadata ...........
vtk                          5.10.1                   py27_0  defaults        
                             5.10.1                   py27_1  defaults        
                             6.3.0                    py27_0  defaults        
                             6.3.0                    py27_1  defaults 

创造最好的环境

$ conda create -n vtk python=2.7 vtk=6.3.0
Fetching package metadata ...........
Solving package specifications: .

Package plan for installation in environment /home/sidon/opt/anaconda3/envs/vtk:

The following NEW packages will be INSTALLED:

    openssl:    1.0.2k-1     
    pip:        9.0.1-py27_1 
    python:     2.7.13-0     
    readline:   6.2-2        
    setuptools: 27.2.0-py27_0
    sqlite:     3.13.0-0     
    tk:         8.5.18-0     
    vtk:        6.3.0-py27_1 
    wheel:      0.29.0-py27_0
    zlib:       1.2.8-3      

Proceed ([y]/n)? y

vtk-6.3.0-py27 100% |#############################################################################################| Time: 0:00:15   1.97 MB/s
#
# To activate this environment, use:
# > source activate vtk
#
# To deactivate this environment, use:
# > source deactivate vtk
#

激活新环境

$ source activate vtk

测试

$ python -c "import vtk; print vtk.vtkSphereSource()"
vtkSphereSource (0xcfdcc0)
  Debug: Off
  Modified Time: 39
  Reference Count: 2
  Registered Events: (none)
  Executive: 0xae5e00
  ErrorCode: Success
  Information: 0xf6e210
  AbortExecute: Off
  Progress: 0
  Progress Text: (None)
  Theta Resolution: 8
  Phi Resolution: 8
  Theta Start: 0
  Phi Start: 0
  Theta End: 360
  Phi End: 180
  Radius: 0.5
  Center: (0, 0, 0)
  LatLong Tessellation: 0
  Output Points Precision: 0