簡體   English   中英

pip 安裝 PIL 失敗

[英]pip install PIL fails

我正在嘗試安裝 pip 包 PIL。 但是安裝不起作用,拋出以下錯誤。

Could not find a version that satisfies the requirement pil (from xhtml2pdf==0.0.4->-r virtualenv-reqs.txt (line 16)) (from versions: )
  Some externally hosted files were ignored as access to them may be unreliable (use --allow-external pil to allow).
No matching distribution found for pil (from xhtml2pdf==0.0.4->-r virtualenv-reqs.txt (line 16))

當我有舊版本的 pip 時,安裝確實有效,但使用當前版本的 pip 7.1.2我無法下載該軟件包。 我正在使用以下命令安裝 pip 包

pip install --timeout=1000 -i http://pypi.ksjc.sh.colo/simple --trusted-host pypi.ksjc.sh.colo -r virtualenv-reqs.txt

這有什么問題。 我認為這可能是 SSL 問題,這就是我添加--trusted-host標志的原因。 有沒有辦法將--allow-external標志與virtualenv-reqs文件一起使用。

Pillow 是 PIL 的一個維護分支,所以我推薦使用 Pillow。 但是您不能同時安裝兩者。

  1. 首先,取下 PIL 和 Pillow。

  2. 然后使用pip install pillow install Pillow 安裝 Pillow(盡管根據平台,您可能需要一些先決條件)。

  3. 然后確保代碼使用from PIL import Image而不是import Image

您可以嘗試使用Pillow ,它是一個 PIL 叉:

pip install Pillow

要導入使用以下內容:

from PIL import Image

一種解決方案是,右鍵單擊“從 PIL 導入映像”並單擊“安裝映像”

我在 PyCharm IDE 上。

一種對我有用的解決方案:

通過簡單地使用pip install -U Pillow安裝最新版本的pip install -U Pillow我現在可以調用import PIL.Image

我正在使用 PyCharm IDE,但遇到了這個問題。 我只是將鼠標懸停在“PIL”上,然后會出現一個小彈出窗口。 我單擊了更多操作,然后出現了幾個選項。 我點擊了“安裝枕頭”,然后問題就解決了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM