Prev: A Unicode problem -HELP
Next: py2exe and libxml
From: MrBlueSky on 21 Aug 2006 09:18 I wonder if someone could clarify how Python "knows" where modules are - or at least point to some documentation that might help me? Here's what I've been trying: I've installed Python 2.4 Windows, and have also installed tkinter, pmw, cx_Oracle, mssql and pytz (phew!) all under my c:\python24 folder. But when I try to "import pytz" or "import MSSQL" in a Python shell (via IDLE) it's not recognised - yet "import Tkinter", "import Pmw" and "import cx_Oracle" all work. I've experimented with "sys.path" to get the import of pytz to work, but without success so far. I feel as if I'm missing some key piece of information on how this all fits together! Please, help! John
From: Licheng Fang on 21 Aug 2006 10:17 MrBlueSky wrote: > I wonder if someone could clarify how Python "knows" where modules are > - or at least point to some documentation that might help me? Here's > what I've been trying: > > I've installed Python 2.4 Windows, and have also installed tkinter, > pmw, cx_Oracle, mssql and pytz (phew!) all under my c:\python24 folder. > > But when I try to "import pytz" or "import MSSQL" in a Python shell > (via IDLE) it's not recognised - yet "import Tkinter", "import Pmw" and > "import cx_Oracle" all work. > > I've experimented with "sys.path" to get the import of pytz to work, > but without success so far. > > I feel as if I'm missing some key piece of information on how this all > fits together! Please, help! > > John You may have to add the path of the module to a system environment variable "PYTHONPATH" to make it work.
From: Sibylle Koczian on 21 Aug 2006 10:36 MrBlueSky schrieb: > I wonder if someone could clarify how Python "knows" where modules are > - or at least point to some documentation that might help me? Here's > what I've been trying: > > I've installed Python 2.4 Windows, and have also installed tkinter, > pmw, cx_Oracle, mssql and pytz (phew!) all under my c:\python24 folder. > > But when I try to "import pytz" or "import MSSQL" in a Python shell > (via IDLE) it's not recognised - yet "import Tkinter", "import Pmw" and > "import cx_Oracle" all work. > Normally extensions should go into a subdirectory of c:\python24\Lib\site-packages. Everything that comes with a windows installer usually installs itself exactly there. In those cases no messing about with PYTHONPATH or sys.path should be necessary. HTH Koczian -- Dr. Sibylle Koczian Universitaetsbibliothek, Abt. Naturwiss. D-86135 Augsburg e-mail : Sibylle.Koczian(a)Bibliothek.Uni-Augsburg.DE
From: MrBlueSky on 22 Aug 2006 03:23 Thanks for the suggestions, folks.. site-packages ~~~~~~~~~~ OK, I'm been trying to get MSSQL into c:\Python24\lib\site-packages. MSSQL comes (as a tar'd, zip'd file) with a folder hierarchy with MSSQL.py at the top level and then bin\python2.3\mssqldb.pyd. If I try and copy this folder hierarchy into site-packages and "import MSSQL" then it recognises MSSQL.py but fails to import mssqldb, as that's imported from MSSQL.py. I've noticed a setup.py in the MSSQL folder, but it looks like it has odd hard-coded paths in it (D:\...) and anyway when I tried to run it, I found the Usage message less than helpful! I really apologise if this is Bleeding Obvious to everyone else - is there a web page that will explain all this so the lightbulb will go on over my head?! John
From: Sibylle Koczian on 22 Aug 2006 10:06
Steve Holden schrieb: > You won;t get MySQLdb to run without running the setup.py since IIRC > there's a compile step for a C library (and it's that compile step that > needs to be able to find the MySQL client libraries). > But MySQLdb comes with a windows installer. No need to tweak anything. Sometimes you've got to choose between a slightly older version without install worries and the newest source, but not at the moment. -- Dr. Sibylle Koczian Universitaetsbibliothek, Abt. Naturwiss. D-86135 Augsburg e-mail : Sibylle.Koczian(a)Bibliothek.Uni-Augsburg.DE |