Python pip安装PIL失败
我正在尝试安装pip包PIL。但是,安装失败,抛出以下错误Python pip安装PIL失败,python,django,pip,python-imaging-library,Python,Django,Pip,Python Imaging Library,我正在尝试安装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 (
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时,安装确实有效,但使用当前版本的pip7.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
标志。有没有办法将--允许外部
标志与virtualenv reqs
文件一起使用。抱枕是PIL的维护工具,因此我建议使用抱枕。但是不能同时安装这两个
pip安装枕头(不过,根据平台的不同,您可能需要一些)
,而不是导入图像的
pip install Pillow
要导入或使用以下内容:
from PIL import Image
一种解决方案是,右键单击“从PIL导入图像”,然后单击 “安装映像”
我当时在Pyarm IDE上 一个对我有效的解决方案:
通过使用
pip install-U Pillow
安装最新版本的Pillow,我现在可以调用import PIL.Image
我使用的是PyCharm IDE,我遇到了这个问题。我只是将鼠标悬停在“PIL”上,然后出现了一个小弹出窗口。我单击了更多操作,出现了几个选项。我单击“安装枕头”,然后,问题解决了。您是否尝试过安装枕头
PIL
在pip中安装有点复杂Pillow
是一个代用品。@RodXavier我也在安装Pillow
,但pil
是我正在安装的另一个名为xhtml2pdf
的软件包中的一个要求,错误消息如下:--允许外部pil
(不确定这是否与虚拟需求相冲突)@user3831214当我查看时,我在requirements.txt中看到的是提到的枕头,而不是PIL。所以PIL并不是xhtml2pdf的真正要求。@MichielOvertoom哦,这很有趣,那么为什么它说没有找到与PIL匹配的发行版(来自xhtml2pdf…)?使用Ubuntu14.04 LTS唯一对我有帮助的是:$sudo apt get install libtiff5 dev libjpeg 8 dev zlib1g dev libfreetype6 dev liblcms2 dev libwebp dev tcl8.6-dev tk8.6-dev python tk
我尝试过这个方法,但当我这么做时,它说“没有名为PIL的模块”@hiquetj我也遇到了同样的问题。通过添加requirementpillow>=4
解决。未定义全局名称“PIL”。链接到文档将使此答案更清晰。