python - 如何彻底卸载并重新安装Pillow?

标签 python python-imaging-library

我正在尝试在我的服务器上重新安装 Pillow,但收到以下消息:

...
Proceed (y/n)? y
  Successfully uninstalled Pillow-4.0.0
(myproject)$ pip install --upgrade --force-reinstall Pillow
Collecting Pillow
  Using cached Pillow-4.0.0-cp27-cp27mu-manylinux1_x86_64.whl
Collecting olefile (from Pillow)
  Using cached olefile-0.44.zip
Building wheels for collected packages: olefile
  Running setup.py bdist_wheel for olefile ... error
  Complete output from command /home/user/.virtualenvs/myproject/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-C7Frjt/olefile/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpToYPN3pip-wheel- --python-tag cp27:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Failed building wheel for olefile
  Running setup.py clean for olefile
Failed to build olefile
Installing collected packages: olefile, Pillow
  Found existing installation: olefile 0.44
    Uninstalling olefile-0.44:
      Successfully uninstalled olefile-0.44
  Running setup.py install for olefile ... done
Successfully installed Pillow-4.0.0 olefile-0.44

(myproject)$ python
>>> import Pillow
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named Pillow

我做错了什么?

编辑:我还尝试删除 Pillow 和 PIL 目录,但我仍然无法让它工作:

(myproject)$ rm -rf PIL
(myproject)$ rm -rf Pillow-4.0.0.dist-info/
(myproject)$ pip install Pillow
Collecting Pillow
  Using cached Pillow-4.0.0-cp27-cp27mu-manylinux1_x86_64.whl
Requirement already satisfied: olefile in ./.virtualenvs/myproject/lib/python2.7/site-packages (from Pillow)
Installing collected packages: Pillow
Successfully installed Pillow-4.0.0
(myproject)$ python
Python 2.7.5 (default, Nov  6 2016, 00:28:07) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Pillow
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named Pillow
>>> 

最佳答案

尝试使用并查看是否有效。

导入PIL

或者

import PIL as pillow
from PIL import Image

关于python - 如何彻底卸载并重新安装Pillow?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43054740/

相关文章:

python - read_sql 和 redshift 在 unicode 上给出错误

python - 在 C++ 中嵌入 python : Assigning C++ and python variables

python - 无法打开资源: OS Error

python - 将 autopy 位图转换为 Pillow 图像

python-3.x - 枕头 : image to bytes to image

python - PIL - 添加半透明多边形到 JPEG

python - 使用 python 对 wav RIFF 文件进行下采样

python - 'numpy.ndarray' 对象没有属性 'index'

python - 在 pandas DataFrameGroupBy 对象上使用 `rank`

python - 确定内存中的图像