How do I set up a local python library directory / PYTHONPATH?

前端 未结 2 1270
感动是毒
感动是毒 2021-02-09 13:32

In the process of trying to write a Python script that uses PIL today, I discovered I don\'t seem have it on my local machine (OS X 10.5.8, default 2.5 Python install).

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-09 13:57

    You are using the Apple-supplied Python 2.5 in OS X; it's a framework build and, by default, uses /Library/Python/2.5/site-packages as the location for installed packages, not /usr/local. Normally you shouldn't need to specify --prefix with an OS X framework build. Also beware that the setuptools (easy_install) supplied by Apple with OS X 10.5 is also rather old as is the version of Python itself.

    That said, installing PIL completely and correctly on OS X especially OS X 10.5 is not particularly simple. Search the archives or elsewhere for tips and/or binary packages. Particularly if you are planning to use other modules like MySQL or Django, my recommendation is to install everything (Python and PIL) using a package manager like MacPorts.

提交回复
热议问题