I read a book to learn python programming, it showed the code :
import media
So I downloaded gwpy-code.zip from the link http://pragprog.com/titles/gwpy/source_code and installed PyGraphics-2.0.win32.exe . In the path C:\Python27\Lib\site-packages\pygraphics there really was media.py ! But why import media didn’t work ?
(ps: I also tried this C:\Python27\Scripts\easy_install nose in the DOS box, still not work…)
Best Regards 🙂
Try:
If you’re not familiar with importing modules in Python yet, a brief primer might be useful.
If you try the code above, you will see a bunch of directories on your system path.
C:\Python27\Lib\site-packages\should be one of these.To import a file located on your system path, you can use
import filename(for filename.py). If the file lies in a subdirectory, e.g.dir1/dir2/filename.py, it can be imported usingimport dir1.dir2.filename.Note: A directory acts as a ‘package’ if it contains a file called
__init__.py. A file that can be imported is called a ‘module’.