PyCharm pip 和 PIL 安装

huangapple go评论73阅读模式
英文:

PyCharm pip and PIL installation

问题

在尝试将PIL安装到我的PyCharm项目时,我遇到了以下错误:

ERROR: No matching distribution found for PIL
WARNING: You are using pip version 21.3.1; however, version 23.1.2 is available.
You should consider upgrading via the 'C:\Users\fooBar\PycharmProjects\pythonProject8\venv\Scripts\python.exe -m pip install --upgrade pip' command.

当我执行这个命令时,Shell输出是:

Requirement already satisfied: pip in c:\users\fooBar\anaconda3\lib\site-packages (23.1.2)

但是尝试安装PIL时仍然遇到相同的错误,所以我尝试在PyCharm中删除并重新安装pip(21.3.1),成功安装了pip 23.1.2。但是当我重新尝试安装PIL时,我收到以下错误:

ERROR: No matching distribution found for PIL```


<details>
<summary>英文:</summary>

when trying to install PIL to my pyCharm project I get the following error:

ERROR: Could not find a version that satisfies the requirement PIL (from versions: none)
ERROR: No matching distribution found for PIL
WARNING: You are using pip version 21.3.1; however, version 23.1.2 is available.
You should consider upgrading via the 'C:\Users\fooBar\PycharmProjects\pythonProject8\venv\Scripts\python.exe -m pip install --upgrade pip' command.

when I do this the shell output is 

Requirement already satisfied: pip in c:\users\fooBar\anaconda3\lib\site-packages (23.1.2)

But get the same error for PIL install, so I tried deleting pip (21.3.1) in pyCharm and reinstalling which successfully installs pip 23.1.2. But then when I retry PIL install i get this error

ERROR: Could not find a version that satisfies the requirement PIL (from versions: none)
ERROR: No matching distribution found for PIL





</details>


# 答案1
**得分**: 2

The package `PIL` does no longer exist.
这个包`PIL`不再存在。

You need to install the package `pillow`, which originally was a fork of `PIL`.
您需要安装`pillow`包,它最初是`PIL`的分支。

You need to do `pip install pillow`, or install it directly through the IDE into the correct venv. This will still give you the python module `PIL`.
您需要执行`pip install pillow`,或者直接通过IDE安装到正确的虚拟环境中。这将仍然为您提供Python模块`PIL`。

<details>
<summary>英文:</summary>


The package `PIL` does no longer exist.

You need to install the package `pillow`, which originally was a fork of `PIL`.

You need to do `pip install pillow`, or install it directly through the IDE into the correct venv. This will still give you the python module `PIL`

</details>



# 答案2
**得分**: 1

与@FlyingTeller一样,`PIL`由Fredrik Lundh最初编写,是Python 2编程语言的原始软件包,用于图像处理(这就是它的全名为“Python Image Library”的原因)。但是,由于对Python版本2的支持已经停止,因此随后移除了`PIL`。

相反,您应该使用以下shell代码:

```shell
pip3 install pillow

然后,在项目中执行导入语句时,只需编写

from PIL import image

查看Pillow文档以获取更多信息(https://pillow.readthedocs.io/en/stable/)。

英文:

Same as @FlyingTeller, PIL, written by Fredrik Lundh originally, is an original package for the Python 2 programming language, use in image processing (and that's why its full name is 'Python Image Library'). However, because of the dropped support for the Python version 2, PIL was then removed.

Instead, you should use the following shell code:

pip3 install pillow

Then, when perform the import statement inside your project, simply write

from PIL import image

See Pillow docs for more information (https://pillow.readthedocs.io/en/stable/).

huangapple
  • 本文由 发表于 2023年5月11日 19:28:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/76227134.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定