티스토리 뷰

반응형

Stack Overflow에 자주 검색, 등록되는 문제들과 제가 개발 중 찾아 본 문제들 중에서 나중에도 찾아 볼 것 같은 문제들을 정리하고 있습니다.

Stack Overflow에서 가장 먼저 확인하게 되는 가장 높은 점수를 받은 Solution과 현 시점에 도움이 될 수 있는 가장 최근에 업데이트(최소 점수 확보)된 Solution을 각각 정리하였습니다.

 

아래 word cloud를 통해 이번 포스팅의 주요 키워드를 미리 확인하세요.

How to install PIL with pip on Mac OS?

Mac OS에서 PIP를 사용하여 PIL을 설치하는 방법은 무엇입니까?

 문제 내용 

I am trying to install PIL (the Python Imaging Library) using the command:

다음 명령을 사용하여 PIL(Python Imaging Library)을 설치하려고 합니다.

 

sudo pip install pil

but I get the following message:

하지만 나는 다음과 같은 메시지를 받는다.

 

Downloading/unpacking PIL
  You are installing a potentially insecure and unverifiable file. Future versions of pip will default to disallowing insecure files.
  Downloading PIL-1.1.7.tar.gz (506kB): 506kB downloaded
  Running setup.py egg_info for package PIL
    WARNING: '' not a valid package name; please use only.-separated package names in setup.py
    
Installing collected packages: PIL
  Running setup.py install for PIL
    WARNING: '' not a valid package name; please use only.-separated package names in setup.py
    --- using frameworks at /System/Library/Frameworks
    building '_imaging' extension
    clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -IlibImaging -I/System/Library/Frameworks/Python.framework/Versions/2.7/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.8-intel-2.7/_imaging.o
    unable to execute clang: No such file or directory
    error: command 'clang' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/private/tmp/pip_build_root/PIL/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-AYrxVD-record/install-record.txt --single-version-externally-managed:
    WARNING: '' not a valid package name; please use only.-separated package names in setup.py

running install

running build

.
.
.
.

copying PIL/XVThumbImagePlugin.py -> build/lib.macosx-10.8-intel-2.7

running build_ext

--- using frameworks at /System/Library/Frameworks

building '_imaging' extension

creating build/temp.macosx-10.8-intel-2.7

creating build/temp.macosx-10.8-intel-2.7/libImaging

clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -IlibImaging -I/System/Library/Frameworks/Python.framework/Versions/2.7/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.8-intel-2.7/_imaging.o

unable to execute clang: No such file or directory

error: command 'clang' failed with exit status 1

----------------------------------------
Cleaning up…

Could you please help me to install PIL?

PIL 설치를 도와주실 수 있나요?

 

 

 

 높은 점수를 받은 Solution 

  1. Install Xcode and Xcode Command Line Tools as mentioned.
  2. Use Pillow instead, as PIL is basically dead. Pillow is a maintained fork of PIL.
언급한 대로 Xcode 및 Xcode 명령줄 도구를 설치합니다.
PIL이 기본적으로 죽었기 때문에 대신 Pillow를 사용하십시오. Pillow는 PIL의 유지보수 포크입니다.

 

https://pypi.org/project/Pillow/

https://pypi.org/project/Pillow/

 

pip install Pillow

If you have both Pythons installed and want to install this for Python3:

Python을 모두 설치하고 Python3용으로 설치하려는 경우:

 

python3 -m pip install Pillow

 

 

 가장 최근 달린 Solution 

Install

설치하다

 

pip install Pillow

Then, Just import in your file like,

그런 다음 파일로 다음과 같이 가져옵니다.

 

from PIL import Image

I am using windows. It is working for me.

나는 Windows를 사용하고 있다. 저한테 효과가 있어요.

 

NOTE:

Pillow is a functional drop-in replacement for the Python Imaging Library. To run your existing PIL-compatible code with Pillow, it needs to be modified to import the Imaging module from the PIL namespace instead of the global namespace.

참고: Pillow는 Python Imaging의 기능적인 드롭인 PIL의 대체품입니다. Pillow를 사용하여 기존 PIL 호환 코드를 실행하려면 PIL에서 이미징 모듈을 가져오려면 수정해야 합니다. 전역 네임스페이스 대신 네임스페이스를 사용합니다.

 

i.e. change:

즉, 변경:

 

import Image

to:

대상:

 

from PIL import Image

https://pypi.org/project/Pillow/2.2.1/

https://pypi.org/project/Pillow/2.2.1/

 

 

 

출처 : https://stackoverflow.com/questions/20060096/how-to-install-pil-with-pip-on-mac-os

반응형
댓글
공지사항
최근에 올라온 글