Programing

PIP가 있는 PIL을 Mac OS에 설치하는 방법?

c10106 2022. 3. 14. 20:55
반응형

PIP가 있는 PIL을 Mac OS에 설치하는 방법?

다음 명령을 사용하여 Python Imaging Library(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의 유지된 포크다.

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

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

이 명령을 사용하여 이 명령을 수행하는 것은 매우 간단하다.

sudo apt-get install python-PIL

또는

sudo pip install pillow

또는

sudo easy_install pillow

설치

pip install Pillow

그런 다음 파일에 다음과 같이 가져오십시오.

from PIL import Image

나는 창문을 사용하고 있다.그것은 나에게 효과가 있다.

참고:

베개는 Python Imaging Library의 기능적 드롭인 대체품이다.기존 PL 호환 코드를 Berep과 함께 실행하려면 글로벌 네임스페이스가 아닌 PL 네임스페이스에서 이미징 모듈을 가져오도록 수정해야 한다.

즉, 변화:

import Image

다음으로:

from PIL import Image

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

여기에 설명된 대로 설치하십시오.

pip install image

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

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

는 여기서 토론에서 답을 얻었다.

나는 노력했다.

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

그리고 그것은 성공하였다.

네가 맥에 있는 것 같구나.자세한 내용은 Mac os x 10.7.2 Lion에 PL을 설치하는 방법을 참조하십시오.

[홈브루][]를 사용하면 PL을 설치하기만 하면 된다.brew install pil설치 디렉토리를 추가하십시오($(brew --prefix)/lib/python2.7/site-packages, PYSONPATHE라는 의 위치 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

방금 위 내용(OSX 10.7.2, XCode 4.2.1 및 System Python 2.7.1)을 실행했는데, 내 환경에 있는 것이 기본값이 아닐 가능성이 있지만, 잘 구축되었다.

[홈브루]:http://mxcl.github.com/homebrew/ "홈브루"

우분투에게 PIL은 더 이상 통하지 않는다.항상 받는 이점:

PL에 대한 일치하는 배포를 찾을 수 없음

python-imaging을 설치하십시오.

sudo apt-get install python-imaging

요즘, 모든 사람들은 PL보다 다정한 PL 포크인 베개를 사용한다.

대신:sudo pip install pil

작업:sudo pip install pillow

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

나도 같은 문제를 겪고 있지만 설치로 해결된다.python-dev.

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

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

센트용OS:

yum install python-imaging

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

  1. http://www.pythonware.com/products/pil/#pillimit 사이트로 이동
  2. 소스를 다운로드하려면 "Python Imaging Library 1.1.7 Source Kit"를 클릭하십시오.
  3. tar xf Imaging-1.1.7.tar.gz
  4. cd Imaging-1.1.7
  5. sudo python setup.py install

을 써서 못을 박았다.sudo port install py27-Pillow

다음을 시도해 보십시오.

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

(Window) 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

  • 그리고 마침내 필을 설치한다.pip install pillow

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

Ubuntu의 경우, PIL을 설치할 수 있다.apt install:

Python 3의 경우:

sudo apt install python3-pil

Python 2의 경우:

sudo apt install python-pil

어디에pilClarkey252가 지적하는 바와 같이 소문자여야 한다.

Python 패키지 툴이 또 있어. C++와 다른 순수한 Python이 아닌 다른 바인딩을 설치해야 하는 라이브러리가 있을 때는 pip보다 콘다가 더 선호(믿음)콘다는 설치물에 pip을 포함하므로 당신은 여전히 pip을 사용할 수 있지만, 당신은 콘다의 이점 또한 얻을 수 있다.

콘다는 또한 IPython, pil, 그리고 많은 다른 도서관들을 기본적으로 설치한다.좋아하실 겁니다.

참조URL: https://stackoverflow.com/questions/20060096/how-to-install-pil-with-pip-on-mac-os

반응형