5

Mac OSX 10.7.4にPILをインストールしようとしていますが、数時間経っても成功しませんでした。私はいつも同じ問題に遭遇しましたが、以下のペーストビンのリンクに詳細が記載されています。私を啓発します!!

設定

tbc:~ mystic$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python

Pastebin

私はいくつかのソースから検索して試しました:

Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Image
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named Image
>>> import PIL
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named PIL
>>>

によって提案されたように編集されましjdiたが、上記のペーストビンリンクに示されているのと同じ問題をまだ実行しています

tbc:jpeg-8c mystic$ xcode-select -version
xcode-select version 2003.
tbc:jpeg-8c mystic$ which xcode-select
/usr/bin/xcode-select
tbc:jpeg-8c mystic$ xcode-select -print-path
/Applications/Xcode.app/Contents/Developer
tbc:jpeg-8c mystic$

さらに、「the paul」が示唆するように自作を試してみました

tbc:cellar mystic$ brew link jpeg
Linking /usr/local/Cellar/jpeg/8d... 3 symlinks created
tbc:cellar mystic$ brew install pil
Error: pil-1.1.7 already installed
tbc:cellar mystic$ brew uninstall pil
Uninstalling /usr/local/Cellar/pil/1.1.7...
tbc:cellar mystic$ brew install pil
==> Downloading http://effbot.org/downloads/Imaging-1.1.7.tar.gz
Already downloaded: /Library/Caches/Homebrew/pil-1.1.7.tar.gz
==> python setup.py build_ext
==> python setup.py install --prefix=/usr/local/Cellar/pil/1.1.7
==> Caveats
This formula installs PIL against whatever Python is first in your path.
This Python needs to have either setuptools or distribute installed or
the build will fail.
Warning: Non-executables were installed to "bin".
Installing non-executables to "bin" is bad practice.
The offending files are:
/usr/local/Cellar/pil/1.1.7/bin/pilfont.py
==> Summary
/usr/local/Cellar/pil/1.1.7: 174 files, 2.0M, built in 15 seconds
tbc:cellar mystic$ python 
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pil
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named pil
>>> from PIL import Image
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named PIL

これが.pipのログです

その不満

/Developer/SDKs/MacOSX10.6.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory

しかし、stdarg.hファイルは同じ場所にあります。

MacOSX10.6.sdk私の現在のバージョンのLionがなぜそれを見つけようとしているのか、私にはわかりません。MacOSX10.7.sdk

夢中!!!

4

3 に答える 3

9

最新のXCodeを使用してLionを使用している場合、潜在的な問題は、開発者SDKの場所が移動したことです。それらが住むことを期待していたパッケージは/Developer/、必要に応じてそれらを見つけることができなくなります。

詳細については、この記事を参照してください:
http ://www.agile-workers.com/web/2012/03/qt-qmake-osx_sdk-xcode/

しかし、要約すると、実行する必要がある
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer
のは、新しい場所を指すことです。

手動で修正するには、SDKを/Applications/Xcode.app/Contents/Developer/...=>からシンボリックリンクするだけかもしれませんが/Developer/...、最初にxcode-selectツールを試してみます。

更新:新しい更新に基づくいくつかの提案

まず、SDKが原因でPILがビルドに失敗したかどうかは、あなたが投稿した内容からはわかりません。正常にビルドされ、標準のアップルpythonを使用している場合は、自作のpythonパスが独自のpythonパスにない可能性があります。

$ python
>>> import sys
>>> sys.path.append("/usr/local/lib/python2.7/site-packages")
>>> from PIL import Image

それでもエラーが発生する場合は、SDKの場所が見つからないことに問題があると思われます。SDKの新しい場所を古い場所にシンボリックリンクするには、次のようにします。

mkdir -p -v /Developer/SDKs
ln -s /Applications/Xcode.app/Contents/Developer/MacOSX10.6.sdk  /Developer/SDKs/MacOSX10.6.sdk

または、pilをビルドするときにsdkパスを明示的に設定してみることができます。

brew remove pil
export SDKROOT=/Applications/Xcode.app/Contents/Developer/MacOSX10.6.sdk
brew install pil
于 2012-05-18T20:05:05.380 に答える
1

簡単な解決策:

  1. Homebrewをインストールする
  2. 醸造インストール枕

:)

于 2012-05-18T19:32:11.107 に答える
0

Homebrewをインストールしている場合、これでうまくいきます。

brew install pillow
于 2017-02-04T11:23:37.923 に答える