本文介绍了建议升级枕头,但已经是最新的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试修复对Image模块的调用(我直到现在才知道此Python映像库),并且我需要升级Pillow,因为/usr/lib/python3/dist-packages/PIL/Image.py中的文件声明版本为1.1.7,但有更新的版本可用。

$  sudo pip3 install Pillow
[sudo] password di user: 
The directory '/home/user/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled.           

Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/user/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied (use --upgrade to upgrade): Pillow in /usr/lib/python3/dist-packages
You are using pip version 8.1.1, however version 19.2.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

You are using pip version 8.1.1, however version 19.2.1 is available.

但是,当我尝试升级时:

user:~/Downloads$ pip3 install --upgrade pip
Requirement already up-to-date: pip in /home/user/.local/lib/python3.7/site-packages (19.2.1)

我糊涂了,我漏掉了什么?

推荐答案

第一条消息告诉您有适用于Pip的升级,而不是Pillow。

第一个命令使用sudo。第二个不是。您必须在sudo路径和用户路径中使用不同的pip。

不建议将sudo与pip一起使用。请改用--user开关。

此外,Image.py中的1.1.7版本是PIL的版本,而Pillow是其中的一个分支。Pillow本身有另一个版本号,正在从Pillow中删除1.1.7版本。

因此不要使用sudo pip3 ...,而应使用:

pip3 install --user --upgrade pip
pip3 install --user --upgrade pillow

这篇关于建议升级枕头,但已经是最新的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 15:36