Programing

pip로 PIL 설치

lottogame 2020. 3. 12. 08:07
반응형

pip로 PIL 설치


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

sudo pip install pil

하지만 다음과 같은 메시지가 나타납니다.

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…

PIL을 설치하도록 도와 주시겠습니까?


  1. 언급 한대로 Xcode 및 Xcode 명령 행 도구를 설치하십시오.
  2. PIL이 기본적으로 죽었으므로 베개를 대신 사용하십시오. 베개는 PIL의 유지 포크입니다.

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

pip install Pillow

두 Python이 모두 설치되어 있고 Python3 용으로 설치하려는 경우 :

python3 -m pip install Pillow

이것은 나를 위해 작동합니다 :

apt-get install python-dev
apt-get install libjpeg-dev
apt-get install libjpeg8-dev
apt-get install libpng3
apt-get install libfreetype6-dev
ln -s /usr/lib/i386-linux-gnu/libfreetype.so /usr/lib
ln -s /usr/lib/i386-linux-gnu/libjpeg.so /usr/lib
ln -s /usr/lib/i386-linux-gnu/libz.so /usr/lib

pip install PIL  --allow-unverified PIL --allow-all-external

apt install을 사용하면이 명령을 사용하여 매우 간단합니다.

sudo apt-get install python-PIL

또는

sudo pip install pillow

또는

sudo easy_install pillow

Mac OS X에서는 다음 명령을 사용하십시오.

sudo pip install https://effbot.org/media/downloads/Imaging-1.1.7.tar.gz

여기에 설명 된대로 설치해야 합니다 .

pip install image

토론 에서 답을 얻었습니다 .

나는 시도했다

pip install --no-index -f http://dist.plone.org/thirdparty/ -U PIL

그리고 효과가있었습니다.


요즘에는 누구나 PIL보다 친절한 PIL 포크 인 Pillow를 사용합니다.

대신에: sudo pip install pil

하다: sudo pip install pillow

$ sudo apt-get install python-imaging
$ sudo -H pip install pillow

우분투의 경우 PIL이 더 이상 작동하지 않습니다. 나는 항상 얻는다 :

PIL에 대한 일치하는 분포가 없습니다.

python-imaging을 설치하십시오 :

sudo apt-get install python-imaging

나는 당신이 Mac에 있다고 생각합니다. mac OS x 10.7.2 Lion에 PIL을 설치하는 방법을 참조하십시오.

[homebrew] []를 사용하는 경우 PIL 만 설치하면 brew install pil됩니다. 그런 다음 설치 디렉토리 ( $(brew --prefix)/lib/python2.7/site-packages)를 PYTHONPATH에 추가하거나 PIL 디렉토리 자체의 위치를 PIL.pth사이트 패키지 디렉토리의 파일에있는 파일에 내용과 함께 추가해야합니다.

/usr/local/lib/python2.7/site-packages/PIL

(가정 brew --prefix이다 /usr/local).

또는 소스에서 다운로드 / 빌드 / 설치할 수 있습니다.

# download
curl -O -L http://effbot.org/media/downloads/Imaging-1.1.7.tar.gz
# extract
tar -xzf Imaging-1.1.7.tar.gz
cd Imaging-1.1.7
# build and install
python setup.py build
sudo python setup.py install
# or install it for just you without requiring admin permissions:
# python setup.py install --user

나는 지금 (XCode 4.2.1 및 System Python 2.7.1과 함께 OSX 10.7.2에서) 위를 실행했으며 환경에서 무언가가 기본값이 아닐 수도 있지만 제대로 빌드되었습니다.

[homebrew] : http://mxcl.github.com/homebrew/ "Homebrew"


같은 문제가 있지만의 설치로 해결됩니다 python-dev.

PIL을 설치하기 전에 다음 명령을 실행하십시오.

sudo apt-get install python-dev

그런 다음 PIL을 설치하십시오.

pip install PIL

설치하는 동안 오류가 발생했습니다. 누군가가 이것을 가지고있는 경우를 대비하여. 그럼에도 불구하고 나는 이미 관리자 사용자이지만 루트는 아닙니다.

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/PIL'

Storing debug log for failure in /Users/wzbozon/Library/Logs/pip.log

"sudo"를 추가하면 sudo와 함께 문제가 해결되었습니다.

~/Documents/mv-server: $ sudo pip install Pillow

CentOS의 경우 :

yum install python-imaging

나는 모든 대답을 시도했지만 실패했습니다. 공식 사이트에서 직접 소스를 가져온 다음 설치 성공을 구축하십시오.

  1. http://www.pythonware.com/products/pil/#pil117 사이트로 이동
  2. "Python Imaging Library 1.1.7 소스 키트"를 클릭하여 소스를 다운로드하십시오.
  3. 타르 xf 이미징 -1.1.7.tar.gz
  4. CD 이미징 -1.1.7
  5. sudo python setup.py 설치

사용하여 못을 박았다 sudo port install py27-Pillow


이 시도:

sudo pip install PIL --allow-external PIL --allow-unverified PIL

(창) Pilow가 작동하지 않으면 http://www.pythonware.com/products/pil/ 에서 pil을 다운로드 하십시오.


  • 먼저 이것을 실행하여 sudo apt-get build-dep python-imaging필요한 모든 종속성을 제공해야합니다.

  • 그런 다음 실행 sudo apt-get update && sudo apt-get -y upgrade

  • 뒤에 sudo apt-get install python-pip

  • 마지막으로 Pil을 설치하십시오. pip install pillow


설치

pip install Pillow

그런 다음 파일에 다음과 같이 중요합니다.

from PIL import Image

나는 창문을 사용하고 있습니다. 나를 위해 일하고 있습니다.


를 사용하기 전에 패키지 관리자를 검색하십시오 pip. 아치 리눅스에서는 PIL을 얻을 수 있습니다.pacman -S python2-pillow


라는 또 다른 Python 패키지 도구가 conda있습니다. Conda는 C ++ 및 순수 Python이 아닌 다른 바인딩을 설치 해야하는 라이브러리가있을 때 pip보다 선호됩니다 (믿습니다). Conda는 설치에 pip도 포함하므로 pip를 계속 사용할 수 있지만 conda의 이점도 얻을 수 있습니다.

Conda는 기본적으로 IPython , pil 및 기타 여러 라이브러리를 설치합니다 . 당신이 좋아할 것 같아요.

참고 URL : https://stackoverflow.com/questions/20060096/installing-pil-with-pip

반응형