【问题标题】:sudo pip install PIL and error code 1sudo pip install PIL 和错误代码 1
【发布时间】:2012-02-23 22:28:22
【问题描述】:
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$ 

有什么想法吗?我不确定为什么会收到此错误?我刚刚开始使用 PIP,还没有遇到任何问题,我需要将 tar 文件从我的下载文件夹中移出吗?

【问题讨论】:

    标签: python python-imaging-library pip


    【解决方案1】:

    您需要安装 gcc 编译器来构建 PIL。最好使用系统的软件包安装 PIL。例如,在 Ubuntu 中,您必须运行 sudo apt-get install python-imaging。

    在 OSX 上尝试安装 Homebrew 并运行 brew install pil。

    【讨论】:

    • 另外,Homebrew 无论如何都需要安装 XCode,所以它只是毫无意义的绒毛。
    • 这不是没有意义的,因为自制会处理所有依赖项,如果有的话。
    • pip 也会如此——你以前用过pip 吗?
    • pip 不处理二进制依赖项。它只能安装 python 包。 PIL 需要一些 C 库,例如 libjpeg、freetype 和 little-cms,brew 将为您构建它们。
    【解决方案2】:

    您需要安装 XCode 才能安装 gcc,这是您所缺少的。

    【讨论】:

      【解决方案3】:

      一些 Python 包需要从源代码构建。这样做需要gcc,它在 OS X 上由 XCode 提供。如果您没有安装 XCode,install it 应该可以解决问题。

      【讨论】:

        猜你喜欢
        • 2014-02-03
        • 2020-08-24
        • 1970-01-01
        • 2018-08-25
        • 2018-12-24
        • 2022-01-11
        • 2017-12-06
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多