running a .py by double-clicking is not working
I'm using Windows XP.
When I double click the Launch_PyDemos.pyw from the book Programming Python, nothing happens. When I try to run Launch_PyDemos.pyw from command-line, I get the error message:
Traceback (most recent call last):
File "PyDemos2.pyw", line 41, in <module>开发者_运维知识库;
from PP3E.Gui.Tools.windows import MainWindow # a Tk with icon, title, quit
ImportError: No module named PP3E.Gui.Tools.windows
When I set the PythonPath enviroment variable to the PP3E folder, nothing happens. When I append the PP3E folder to the Path enviroment variable, nothing happens. When I copy the PP3E directory tree to the site-packages folder in your Python source library, nothing happens.
What is going on?
You're missing libraries from the book. Quoting a bytes thread:
Please follow the instructions on the book, or read the README-PP3E.txt file; below I copy the most relevant parts:
"""Copy the entire PP3E directory tree to some directory on your computer, and add the name of the directory containing PP3E to your module search path (i.e., you PYTHONPATH shell setting, ".pth" files, etc.).
Alternatively, copy the PP3E directory tree to the site-packages folder in your Python source library (e.g., C:\Python24\Lib\site-packages on Windows for Python 2.4). Because this directory is automatically searched on imports, copying here makes PYTHONPATH settings unnecessary."""
Also, make sure you get the updated version from http://examples.oreilly.com/python3/pp3e-updates.html
精彩评论