How to configure python / PYTHONPATH library local directory?

In the process of trying to write a Python script that uses PIL today, I found that I did not see it on my local machine (OS X 10.5.8, default 2.5 Python).

So, I run:

easy_install --prefix=/usr/local/python/ pil

and he complains a little about / usr / local / python / lib / python 2.5 / site-packages that don't exist yet, so I create it and try again and get the following:

TEST FAULT: / usr / local / python // lib / python 2.5 / site-packages DOES NOT support .pth files: bad install directory or PYTHONPATH

You are trying to install a package in a directory that is not included by PYTHONPATH and which Python does not read ".pth" files from. installation directory that you specified (via --install-dir, -prefix or distutils):

/usr/local/python//lib/python2.5/site-packages

PYTHONPATH :

''

, - , . ~/.bash_profile:

PYTHONPATH = "$ PYTHONPATH:/usr/local/python/lib/python2.5"

source .

.

, , PYTHONPATH ; echo $PYTHONPATH :/usr/local/python/lib/python2.5. , include :

import sys
print "\n".join(sys.path)

:

/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python25.zip /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5 /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-darwin /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac/lib-scriptpackages /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload /Library/Python/ 2.5/site-packages /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/PyObjC

/usr/local/python/yadda/yadda .

, . python ?

UPDATE

, PYTHONPATH. , , , sys.path Python. TEST FAILED, , PYTHONPATH.

, /usr/local/python/lib/python2.5 /usr/local/python/lib/python2.5/site-packages, easy_install. , ( ):

Creating /usr/local/python/lib/python2.5/site-packages/site.py
Searching for pil
Reading http://pypi.python.org/simple/pil/
Reading http://www.pythonware.com/products/pil
Reading http://effbot.org/zone/pil-changes-115.htm
Reading http://effbot.org/downloads/#Imaging
Best match: PIL 1.1.7
Downloading http://effbot.org/media/downloads/PIL-1.1.7.tar.gz
Processing PIL-1.1.7.tar.gz
Running PIL-1.1.7/setup.py -q bdist_egg --dist-dir /var/folders/XW/XWpClVq7EpSB37BV3zTo+++++TI/-Tmp-/easy_install-krj9oR/PIL-1.1.7/egg-dist-tmp--Pyauy
--- using frameworks at /System/Library/Frameworks
[snipped: compiler warnings]
--------------------------------------------------------------------
PIL 1.1.7 SETUP SUMMARY
--------------------------------------------------------------------
version       1.1.7
platform      darwin 2.5.1 (r251:54863, Sep  1 2010, 22:03:14)
              [GCC 4.0.1 (Apple Inc. build 5465)]
--------------------------------------------------------------------
--- TKINTER support available
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
*** FREETYPE2 support not available
*** LITTLECMS support not available
--------------------------------------------------------------------
To add a missing option, make sure you have the required
library, and set the corresponding ROOT variable in the
setup.py script.

To check the build, run the selftest.py script.
zip_safe flag not set; analyzing archive contents...
Image: module references __file__
No eggs found in /var/folders/XW/XWpClVq7EpSB37BV3zTo+++++TI/-Tmp-/easy_install-krj9oR/PIL-1.1.7/egg-dist-tmp--Pyauy (setup script problem?)

, , script:

Traceback ( ):
"checkerboard.py", 1,     import Image, ImageDraw ImportError: Image

, /usr/local/python/, find ., :

./lib./lib/python2.5. /lib/python 2.5/site-packages./lib/python2.5/site-packages/site.py. /lib/python 2.5/site-packages/site.pyc

... ( , site.py site.pyc ). ?

:

, selftest.py script.

, .

" ". ?

+5
2

Apple Python 2.5 OS X; /Library/Python/2.5/site-packages , /usr/local. --prefix OS X. , setuptools (easy_install), Apple OS X 10.5, , Python.

, PIL OS X, OS X 10.5, . / . , , MySQL Django, - (Python PIL) , MacPorts.

+4

--prefix easy_install? :

sudo easy_install pil

PIL , , easy_install . (, /usr/local/python ?)

EDIT. - , , , , , , . , : --prefix easy_install, " ". , , easy_install , , . OS X, Mac, --prefix .

+1

All Articles