问题
I already checked ( in stack exchange and other sites) and googled my problem but all solution seems useless. Here's the problem :
My computer had win xp and had python2.7 and panda3d (version 1.8.1) installed (python in D: and panda3d in C: ). The module was working perfectly. Unfortunately I had to format my C drive.
I upgraded to win 7 instead of installing xp again after formatting. Now I had python 2.7 in my D: drive (Which had not been formatted) working perfectly well and only had to install panda in the c: drive at same location again to make my panda files work.
I installed and followed each and every instruction while installing. ( I already had a panda.pth file in my python at my D: drive so no need to make a panda.pth file again). An option came which asked me whether I want to replace existing python and I clicked No as I had done the same the previous time. Now as I had one panda.pth file available in D:/python27 I did not go for creating another and tried to run the following line :
from direct.showbase.ShowBase import ShowBase
Which resulted in the above error. So I deleted my pth file in python27 folder and created again. Nothing worked. I completely removed python and panda3d and reinstalled the complete thing again and made a .pth file again. Still nothing works.
Then on one of the site I visited told me to check my path variables PYTHONHOME and PYTHONPATH but no such path variables are there.
I'm in total distress and none of my panda files are now starting.(Dont mark this Q as duplicate as I have already tried the other solutions in previous replied to the same Q. My problem is certainly different)
Help me!
回答1:
Panda3D ships with its own copy of Python 2.7. You can invoke it by running ppython.exe.
You can use a different version of Python, as long as it is the same major version (2.7) and as long as it is the same architecture (should be 32-bit, as Panda3D 1.8.1 is 32-bit). This means putting a panda.pth file in the site-packages directory, containing absolute paths to the root directory and the "bin" directory of your Panda3D installation, each on a separate line.
You could also install Panda3D 1.9.0, which will ask you during the installation whether you'd like to use an existing Python 2.7 installation, if it finds a compatible one already installed.
来源:https://stackoverflow.com/questions/30506790/panda3d-error-no-module-named-direct-showbase-showbase-in-python-2-7