Panda3D手册:在Linux下安装Panda3D的方法

The Installation Process - Linux

安装方法-Linux

 

The easiest way to install panda is to use the RPM or DEB packages. This is only possible if your version of Linux is one of the provided versions of Linux. If not, you will need to compile from source. If there is an installer available, download and install the RPM or DEB appropriate to your version of Linux.

安装 Panda 最简单的方法是使用RPM包或DEB包来安装。不过这个方法只适用特定的几个Linux发行版。如果您用的是其他的发行版,请下载源代码后编译安装;如果您可以直接使用软件包,请下载对应您Linux版本的RPM包或者DEB包。

 

After installing panda, you should run the sample programs to verify that the installation is good. To do so, you need to change directory to the panda samples directory, select a sample program, change directory to that sample, and run the sample using Python:

安装好Panda之后,您需要运行一些测试程序来检查您安装的是否正确。测试的方法是,进入panda的samples目录,在进入要运行的示例的目录,然后用python运行示例:

$ cd /usr/share/panda3d/samples
$ ls
Asteroids
Ball-in-Maze
Boxing-Robots
Carousel
Cartoon-Shader
Chessboard
Disco-Lights
Fireflies
Fractal-Plants
Glow-Filter
GUI
Infinite-Tunnel
Looking-and-Gripping
Media-Player
Motion-Trails
Music-Box
Normal-Mapping
Particles
Procedural-Cube
Roaming-Ralph
Shadows
Solar-System
Teapot-on-TV
Texture-Swapping
$ cd Boxing-Robots
$ python Tut-Boxing-Robots.py

Using an Unsupported Linux Distribution or an Unsupported Python

 

使用不被支持的Linux发行版或不被支持的Python版本


Python packages need to be compiled for a particular variant of python. For example, a package that works with python 2.4 will not work with python 2.5. A package that works with 32-bit python will not work with 64-bit python. A package that works with UCS2 python will not work with UCS4 python. And so forth. In short, a python package must be carefully aligned, feature-for-feature, with one particular python interpreter. That package will not work with any other python interpreter.

Python软件包需要合适的编译环境。比如,一个包能在python 2.4下运行但不能在python 2.5下运行,一个包能在32位python下运行但不能在64位python下运行,一个包能在UCS2 python下运行但不能在UCS4 python下运行,以此类推。简单地说,每个包都和一个环境一一对应,一个包不能运行在另一个python环境之上。

 

Fortunately for you, our prepackaged copies of Panda3D are already carefully matched. For example, our Panda3D for Ubuntu Gutsy Gibbon is already perfectly matched to the python interpreter that comes with Ubuntu Gutsy Gibbon. So normally, you don't need to worry about this at all.

幸运的是,我们为大部分系统都提供了相应的Panda3D安装包,比如支持Ubuntu Gutsy Gibbon和Ubuntu Gutsy Gibbon后续版本的软件包。所以,没什么好担心的。

 

If your Linux Distribution is not listed, you will need to build your own copy of Panda3D. The build process will automatically create a copy of Panda3D which perfectly matches your Linux Distribution's python interpreter. This is easy to do, but it does require a time-consuming compile. On the other hand, trying to use an RPM or a DEB from some other Distribution is very unlikely to work, because of this need for an exact feature-for-feature match between the python package (Panda3D) and the python interpreter.

如果您的Linux发行版不在我们的支持列表中,您就需要自己编译Panda3D了。编译过程由 python 脚本自动完成。这个过程很简单,但很耗时。从另一个方面说,在这些Linux版本上安装RPM包或者DEB包是不工作的,因为软件包和 Python 的解释器需要和平台对应。

 

If you are using a copy of python other than the one that came with the Linux Distribution, you have a bigger problem. Panda3D's build-scripts automatcially build Panda3D for the system's native python interpreter, not for some other python interpreter. To get Panda3D to build for some other python interpreter, you will have to edit the build scripts.

如果您从其他复制python,您会遇到大问题。Panda3D的编译脚本能根据您的系统编译,换了其他的环境就行不通了。在某些python平台上,您还必须修改编译脚本。

 

What to do if you see the Error Message:

您看到这些提示时:

 

If you see this error:

如果您看到这些提示:

display(error): The application requested harware acceleration, but your OpenGL
display(error): driver, GDI Generic, only supports software rendering.
display(error): You need to install a hardware-accelerated OpenGL driver, or,
display(error): if you actually *want* to use a software renderer, then
display(error): alter the hardware/software configuration in your Config.prc file.
display(error): Window wouldn't open; abandoning window.

This error is fairly self-explanatory: it means your video drivers are inadequate. Obtain better drivers.

这些错的意思是,您的显卡档次太低,换块好一点的吧。

 

What to do if you see the Error Message:

当您看到这些提示时:

 

ImportError: No module named direct.directbase.DirectStart


This error means it couldn't find the python modules -- please make sure you are running the correct version of Python (probably python 2.5, that depends on the Panda3D version) and that the panda3d.pth is located inside the python site-packages directory.

这个错误的意思是没有找到python模块,请安装合适版本的python(python 2.5左右的就可以了),panda3d.pth可以从python网站上下载。

 

What to do if you see the Error Message:

您看到这些提示时:

 

Warning: DirectNotify: category 'Interval' already exists

 

This error is of no consequence. Ignore it.

这个错误可以忽略。

 

What to do if you see the Error Message:

当您看到这些提示时:

 

ImportError: /usr/lib/panda3d/libpandaexpress.so: undefined symbol: PyUnicodeUCS4_AsWideChar


This could mean that your version of python is compiled with the flag Py_UNICODE_SIZE set to 2 . Please find a python version compiled with Py_UNICODE_SIZE set to 4 (which is usually the default). See this forum topic for a more detailed explanation about this problem. 

这个提示的意思是,你的 Py_UNICODE_SIZE 设置成 2 了,应该设置成4(这个通常是默认值)。相关内容请参见论坛