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

前端 未结 2 1271
感动是毒
感动是毒 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 14:00

    Why did you specify --prefix in your easy_install invocation? Did you try just:

    sudo easy_install pil
    

    If you're only trying to install PIL to the default location, I would think easy_install could work out the correct path. (Clearly, /usr/local/python isn't it...)

    EDIT: Someone down-voted this answer, maybe because it was too terse . That's what I get for trying to post an answer from my cell phone, I guess. But the gist of it is perfectly valid, IMHO: if you're using --prefix to specify a custom install location with easy_install, you're kind of 'doing it wrong'. It might be possible to make this work, but the easy_install documentation has a section on custom installation locations that doesn't even mention this as a possibility, except as a small tweak to the virtual python option. I'd suggest following the OS X instructions if you want to install to a custom location on a Mac, --prefix just does not seem like the right tool for the job.

提交回复
热议问题