Mac下Python3.5安装Pillow失败:six、numpy等依赖版本不兼容求助
Hey there! I see you're running into issues installing Pillow for Python 3.5 on your Mac. Let's break down what's going wrong and fix it step by step.
问题根源
First, let's look at your error output:
Jaspers-MBP:~ jasperherrmann$ pip install pillow Collecting pillow Using cached Pillow-5.1.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl prompt-toolkit 1.0.15 requires six>=1.9.0, but you have six 1.4.1 which is incompatible. pandas 0.22.0 requires numpy>=1.9.0, but ...
The key issue here is that you're using pip (which defaults to Python 2.7 on most Macs) instead of the pip version tied to Python 3.5. That's why it's downloading a Pillow package built for Python 2.7 (cp27 in the filename). The dependency conflicts for six and numpy are also from your Python 2 environment, not the Python 3.5 one you care about.
解决步骤
Use Python 3's pip to install Pillow
The easiest fix is to usepip3—this is the pip executable associated with Python 3:pip3 install pillowIf you have multiple Python 3 versions installed and want to target 3.5 specifically, run this instead to be explicit:
python3.5 -m pip install pillowFix dependency conflicts (if they pop up in Python 3)
The dependency errors you see are for your Python 2 setup, so they won't affect your Python 3.5 Pillow installation. But if you ever run into similar issues in your Python 3 environment, you can upgrade the problematic packages:- Upgrade six:
pip3 install --upgrade six - Upgrade numpy:
pip3 install --upgrade numpy
- Upgrade six:
Resolve compilation errors (Mac-specific)
Sometimes Pillow requires system libraries to compile. If you get a compile error during installation, you're probably missing the Xcode Command Line Tools. Install them with this command:xcode-select --installOnce that's done, re-run the Pillow install command.
That should get Pillow up and running for your Python 3.5 environment!
内容的提问来源于stack exchange,提问作者Jasper Herrmann

