On Sun, May 19, 2013 at 3:37 AM, Jim Mooney <cybervigila...@gmail.com> wrote: > > Since Python on Win 7 can already find modules in Lib (and in > site-packages, under Lib) can I assume that it will find any > directories fabricated as mentioned, that are put in Lib or one of its > subdirectories, without doing anything further? > > Also, I didn't have a PYTHONPATH so I made one, but are you allowed > multiple directory entries separated by a semicolon, as in the plain > Windows Path?
Putting packages directly in the standard Lib isn't a good idea. Even the main Lib/site-packages should be reserved for installed packages (i.e. setup.py, pip, exe/msi). Use the environment variable PYTHONPATH to add your own list of directories to sys.path. For NT the list is delimited by a semicolon. > And just how detailed must PYTHONPATH be? Can it just > be the PYTHON27 and PYTHON33 directories, or does it have to drill > down to Lib or directories beneath that? Since there was no PYTHONPATH Those directories are already on sys.path. By the way Python's sys.path for importing modules/packages isn't related to the PATH environment variable. NT uses PATH to find and open files and DLLs, e.g. to find python.exe, python33.dll, and your .py scripts run from the command line. > I figured the win path was enough, but I put one in anyway. Or does > Win 7 put something in the registry? (I'm not sure which I dislike > more - IE or the Registry ;') Python does use NT's registry (either HKLM or HKCU, depending on how you installed) for some for some of the base paths, but don't mess with this: C:\>reg query hklm\software\python\pythoncore\2.7\PythonPath HKEY_LOCAL_MACHINE\software\python\pythoncore\2.7\PythonPath (Default) REG_SZ C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk C:\>reg query hklm\software\python\pythoncore\3.3\PythonPath HKEY_LOCAL_MACHINE\software\python\pythoncore\3.3\PythonPath (Default) REG_SZ C:\Python33\Lib;C:\Python33\DLLs Alternatively you can use your user profile site-packages. On NT, this defaults to "{userbase}/Python{py_version_nodot}/site-packages", where userbase is "%appdata%\Python". You can change the latter by setting the environment variable PYTHONUSERBASE. Check your current setup as follows: userbase = sysconfig.get_config_var('userbase') usersite = sysconfig.get_path('purelib', '%s_user' % os.name) This is the directory pip uses if you install --user. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor