Python 安装枕头和PIL
我已经安装了(精确穿山甲)和一些安装包,PIL。现在我想用抱枕,但不能和PIL同时安装 我看了virtualenv,但还有其他一些软件包我不想安装Python 安装枕头和PIL,python,pillow,Python,Pillow,我已经安装了(精确穿山甲)和一些安装包,PIL。现在我想用抱枕,但不能和PIL同时安装 我看了virtualenv,但还有其他一些软件包我不想安装 有没有其他方法可以在不发生冲突的情况下进行设置?您应该使用(根据需要选择/opt/Pillow)从Git克隆安装Pillow: 然后它包含在你的代码中 import sys sys.path.insert(0, "/opt/pillow") 在做枕头的进口之前 from PIL import Image 这将首先搜索/opt/pillow目录,没
有没有其他方法可以在不发生冲突的情况下进行设置?您应该使用(根据需要选择
/opt/Pillow
)从Git克隆安装Pillow:
然后它包含在你的代码中
import sys
sys.path.insert(0, "/opt/pillow")
在做枕头的进口之前
from PIL import Image
这将首先搜索
/opt/pillow
目录,没有插入的任何东西都不会看到枕头。我设置了一个枕头叉,当使用环境变量pillow\u name
set(例如pillow\u name=PIL
构建时,它可以任意伪装其包名。因此,您可以在PIL软件包名称下安装枕头,如下所示:
$ PILLOW_NAME=PIL pip install -U https://github.com/fish2000/Pillow/archive/master.zip
。。。如果愿意,可以检查自定义包名称安装,如下所示:
$ pip freeze | grep -i pil
[...]
PIL==2.3.0
$ python -c 'from PIL import Image' && echo "PIL installed OK"
PIL installed OK
如果您以“PIL”的名义安装了这个枕叉,您将能够安装需要PIL的软件包。请记住:如果这些软件包依赖于旧的特定于PIL的行为(例如,导入图像
和朋友),这将不会对您有所帮助,但在安装特别需要PIL的软件包时,它将帮助您克服名称问题
$ pip freeze | grep -i pil
[...]
PIL==2.3.0
$ python -c 'from PIL import Image' && echo "PIL installed OK"
PIL installed OK