Can't install PIL after Mac OS X 10.9

前端 未结 28 1024
长情又很酷
长情又很酷 2020-11-28 17:41

I\'ve just updated my Mac OS to 10.9 and I discovered that some (all?) of my Python modules are not here anymore, especially the Image one.

So I try to execute

相关标签:
28条回答
  • 2020-11-28 18:29

    As the accepted answer is the right one with xcode-select --install but some people (including me) may encounter Can't install the software because it is not currently available from the Software Update server If you are using beta software (as I am using Yosemite now and had the same problem) you NEED to get the CLT separately since it is NOT included in XCode (even xcode beta) Head over to developers.apple.com and get CLT tools for your OS ;)

    P.S. You don't need XQuartz for PIL or Pillow to work

    0 讨论(0)
  • 2020-11-28 18:32

    Simply run

    pip install pil --allow-external pil --allow-unverified pil

    0 讨论(0)
  • 2020-11-28 18:33

    open your terminal and execute:

    xcode-select --install

    0 讨论(0)
  • 2020-11-28 18:34

    Make sure you have Command Line Tools installed on your xcode. Then execute:

    sudo pip install pil --allow-external pil --allow-unverified pil
    
    0 讨论(0)
  • 2020-11-28 18:34

    I've moved from pyenv to virtualenv and this fixed my problem.

    0 讨论(0)
  • 2020-11-28 18:36

    Here is what I did, some steps may not be necessary just for PIL but I needed libpng and others anyways:

    1) Run xcode install, use this command or download updates from the app store:

    xcode-select --install
    

    1b) Add the Command Line Tools optional tool, in Mountain Lion this was an option on the xcode Download page, but now you have to register with your apple id and download from: https://developer.apple.com/downloads/

    Look for Command Line Tools (OS X Mavericks) for Xcode

    2) Install everything needed for python (using brew), I believe you can use port as well:

    brew install readline sqlite gdbm
    brew install python --universal --framework 
    brew install libpng jpeg freetype
    

    Unlink/ relink if needed i.e. if upgrading.

    3) Install Pip and required modules:

    easy_install pip 
    sudo pip install setuptools --no-use-wheel --upgrade
    

    4) Finally this works with no errors:

    sudo pip install Pillow
    

    UPDATE 11/04/14: PIL repo no longer receives updates or support so Pillow should be used. The below is now deprecated so stick with Pillow.

    sudo pip install pil --allow-external pil --allow-unverified pil
    

    UPDATE (OLD) : The same thing applies when installing Pillow (PIL fork) and should be mentioned as its quickly becoming a replacement in most cases of PIL. Instead of installing pip in step 4, run this instead:

    sudo pip install Pillow
    

    Hope this helps someone!

    0 讨论(0)
提交回复
热议问题