Python sudo pip安装PIL和错误代码1
有什么想法吗?我不确定为什么我会收到这个错误?我刚刚开始使用PIP-an,还没有遇到任何问题,我需要将tar文件从下载文件夹中移出吗?您需要安装Python sudo pip安装PIL和错误代码1,python,python-imaging-library,pip,Python,Python Imaging Library,Pip,有什么想法吗?我不确定为什么我会收到这个错误?我刚刚开始使用PIP-an,还没有遇到任何问题,我需要将tar文件从下载文件夹中移出吗?您需要安装gcc编译器来构建PIL。最好使用系统包安装PIL。例如,在Ubuntu中,您必须运行sudo apt-get-install-python-imaging 在OSX上尝试安装并运行brew install pil您需要安装XCode才能安装gcc,这正是您所缺少的。一些Python软件包需要从源代码构建。这样做需要gcc,它在OSX上由XCode提供。
gcc
编译器来构建PIL。最好使用系统包安装PIL。例如,在Ubuntu中,您必须运行sudo apt-get-install-python-imaging
在OSX上尝试安装并运行
brew install pil
您需要安装XCode才能安装gcc,这正是您所缺少的。一些Python软件包需要从源代码构建。这样做需要gcc
,它在OSX上由XCode提供。如果您没有安装XCode,它应该可以解决这个问题。此外,Homebrew要求安装XCode,因此它只是毫无意义的绒毛。它不是毫无意义的,因为Homebrew将处理所有依赖项(如果有)。因此,pip
-您以前使用过pip
)吗?pip不处理二进制依赖项。它只能安装python软件包。PIL需要一些C库,如libjpeg
、freetype
和little cms
,而brew
将为您构建它们。
mac-cordreys-macbook-pro:~ maccordrey$ sudo pip install PIL
/usr/local/bin/pip:5: UserWarning: Module pkg_resources was already imported from /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.pyc, but /Library/Python/2.5/site-packages is being added to sys.path
from pkg_resources import load_entry_point
/usr/local/bin/pip:5: UserWarning: Module site was already imported from /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site.pyc, but /Library/Python/2.5/site-packages is being added to sys.path
from pkg_resources import load_entry_point
Downloading/unpacking PIL
Running setup.py egg_info for package PIL
/Library/Python/2.5/site-packages/setuptools/command/install_scripts.py:3: UserWarning: Module pkg_resources was already imported from /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.pyc, but /Library/Python/2.5/site-packages is being added to sys.path
from pkg_resources import Distribution, PathMetadata, ensure_directory
/Library/Python/2.5/site-packages/setuptools/command/install_scripts.py:3: UserWarning: Module site was already imported from /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site.pyc, but /Library/Python/2.5/site-packages is being added to sys.path
from pkg_resources import Distribution, PathMetadata, ensure_directory
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
/Library/Python/2.5/site-packages/setuptools/command/install_scripts.py:3: UserWarning: Module pkg_resources was already imported from /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.pyc, but /Library/Python/2.5/site-packages is being added to sys.path
from pkg_resources import Distribution, PathMetadata, ensure_directory
/Library/Python/2.5/site-packages/setuptools/command/install_scripts.py:3: UserWarning: Module site was already imported from /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site.pyc, but /Library/Python/2.5/site-packages is being added to sys.path
from pkg_resources import Distribution, PathMetadata, ensure_directory
WARNING: '' not a valid package name; please use only.-separated package names in setup.py
--- using frameworks at /System/Library/Frameworks
building '_imaging' extension
gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DMACOSX -I/usr/include/ffi -DENABLE_DTRACE -arch i386 -arch ppc -pipe -IlibImaging -I/System/Library/Frameworks/Python.framework/Versions/2.5/include -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c _imaging.c -o build/temp.macosx-10.5-i386-2.5/_imaging.o
unable to execute gcc: No such file or directory
error: command 'gcc' failed with exit status 1
Complete output from command /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python -c "import setuptools;__file__='/Users/maccordrey/build/PIL/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-5EOlVp-record/install-record.txt:
/Library/Python/2.5/site-packages/setuptools/command/install_scripts.py:3: UserWarning: Module pkg_resources was already imported from /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.pyc, but /Library/Python/2.5/site-packages is being added to sys.path
from pkg_resources import Distribution, PathMetadata, ensure_directory
/Library/Python/2.5/site-packages/setuptools/command/install_scripts.py:3: UserWarning: Module site was already imported from /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site.pyc, but /Library/Python/2.5/site-packages is being added to sys.path
from pkg_resources import Distribution, PathMetadata, ensure_directory
WARNING: '' not a valid package name; please use only.-separated package names in setup.py
running install
running build
running build_py
running build_ext
--- using frameworks at /System/Library/Frameworks
building '_imaging' extension
gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DMACOSX -I/usr/include/ffi -DENABLE_DTRACE -arch i386 -arch ppc -pipe -IlibImaging -I/System/Library/Frameworks/Python.framework/Versions/2.5/include -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c _imaging.c -o build/temp.macosx-10.5-i386-2.5/_imaging.o
unable to execute gcc: No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
Command /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python -c "import setuptools;__file__='/Users/maccordrey/build/PIL/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-5EOlVp-record/install-record.txt failed with error code 1
Storing complete log in /Users/maccordrey/.pip/pip.log
mac-cordreys-macbook-pro:~ maccordrey$