在Python 2.6上运行Panda3D
我第一次使用Panda3D。然后我把里面自带的Python版本删掉了。在我的Python目录里,我放了一个文件叫做 panda.pth
,内容是这样的:
C:\Panda3D-1.6.2
C:\Panda3D-1.6.2\bin
但是当我运行 import direct.directbase.DirectStart
时,出现了:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import direct.directbase.DirectStart
File "C:\Panda3D-1.6.2\direct\directbase\DirectStart.py", line 3, in <module>
from direct.showbase import ShowBase
File "C:\Panda3D-1.6.2\direct\showbase\ShowBase.py", line 10, in <module>
from pandac.PandaModules import *
File "C:\Panda3D-1.6.2\pandac\PandaModules.py", line 1, in <module>
from libpandaexpressModules import *
File "C:\Panda3D-1.6.2\pandac\libpandaexpressModules.py", line 1, in <module>
from extension_native_helpers import *
File "C:\Panda3D-1.6.2\pandac\extension_native_helpers.py", line 75, in <module>
Dtool_PreloadDLL("libpandaexpress")
File "C:\Panda3D-1.6.2\pandac\extension_native_helpers.py", line 73, in Dtool_PreloadDLL
imp.load_dynamic(module, pathname)
ImportError: Module use of python25.dll conflicts with this version of Python.
我猜这可能和我使用的Python 2.6有关。有没有什么解决办法?
2 个回答
3
Python 的扩展在主要版本之间不兼容。这意味着如果你换了 Python 的大版本,之前的扩展可能就不能用了。你可以选择:
A. 重新编译 panda3d 以适配 Python 2.6。
B. 使用 Python 2.5。
没有其他办法了。
2
如果你能等到即将发布的1.7.0版本,它将会是基于Python 2.6编译的——可以查看这个帖子。