为 Python 安装 VTK [英] Installing VTK for Python

查看:118
本文介绍了为 Python 安装 VTK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为 python 安装 VTK 模块,但是我没有成功.我已经下载了一个 VTK tar 文件,但我无法解压它.我能够提取其他 tar 文件,所以我想这个文件一定有特定的东西.

这是我的错误:

gzip: stdin: 无效的压缩数据——违反格式tar:子返回状态 1tar:错误不可恢复:现在退出

希望有人能帮我解决这个问题.

解决方案

答案取决于您使用的操作系统.如果您可以找到适用于您的特定操作系统和/或发行版的软件包或安装程序,这将容易得多.

Linux

如果您使用的是 Linux,请在发行版的包管理器中查找相应的包.例如,在 Ubuntu Linux 上,您应该能够使用以下命令安装它:

sudo apt-get install python-vtk

微软视窗

如果您使用的是 Microsoft Windows,最简单的方法是安装 Python(x,y).它带有 VTK 支持.

此外,Anaconda 还包括 VTK 包以及对虚拟环境的支持.对于某些人来说,这可能是一个不错的选择.

Mac OS X

如果您使用的是 Mac OS X,请尝试通过 MacPorts 安装所有内容.

<小时>

正如@Nil 在下面的评论中提到的,VTK 开发人员现在提供了一个独立的 Python 接口.您可以从此处下载适用于 Windows、Darwin 和 Linux 的软件.<小时>

正如@Nil 所提到的,VTK 过去常常在其 下载vtkpython 二进制文件> 页面.然而,他们从 VTK-8.xx 开始放弃了这个,正如 这里:

<块引用>

抱歉,关于那个.我们决定放弃 8 的 vtkpython 二进制文件.我想把精力集中在支持 python 轮安装上.目前还没有完整解决方案的时间表,但我们最近在此方面取得了一些不错的进展:https://github.com/jcfr/VTKPythonPackage.

因此,现在推荐的安装 vtkpython 的方法是(参见 this页面):

$ python -m pip install --upgrade pip$ python -m pip install vtk

I'm trying to install VTK module for python, I am however unsuccesful in doing so. I have downloaded a VTK tar-file, but I'm unable to extract it. I'm capable of extracting other tar-files, so there must be something specific with this file I suppose.

This is my error:

gzip: stdin: invalid compressed data--format violated tar: Child returned status 1 tar: Error is not recoverable: exiting now

I hope somebody can help me with this.

解决方案

The answer depends on the operating system you are using. This will be a lot easier if you can find a package or installer for your specific operating system and/or distribution.

Linux

If you are using Linux then look for the corresponding package in the distribution's package manager. For example, on Ubuntu Linux you should be able to install it using the following command:

sudo apt-get install python-vtk

Microsoft Windows

If you are using Microsoft Windows, the easiest way would be to install Python(x,y). It comes with VTK support.

Additionally, Anaconda also includes VTK package as well as support for virtual environments. It might be a good option for some folks.

Mac OS X

If you are using Mac OS X, try installing everything via MacPorts.


As @Nil mentioned in comments below, a standalone python interface to VTK is now provided by VTK developers. You may download it for Windows, Darwin, and Linux from here.


As mentioned by @Nil, VTK used to offer vtkpython binaries on their download page. However, they've dropped this since VTK-8.x.x as mentioned here:

Sorry, about that. We decided to drop the vtkpython binaries for 8. I want to focus our energies on supporting python wheel installs instead. There’s no timeline yet for a complete solution but we’ve made some good progress toward that recently here: https://github.com/jcfr/VTKPythonPackage.

Thus, the recommended way of installing vtkpython now is (see this page):

$ python -m pip install --upgrade pip
$ python -m pip install vtk

这篇关于为 Python 安装 VTK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆