我正在构建一个相当广泛的 Python 后端,并且在服务器 A 上运行得很好。然后,我在新的(开发)服务器 B 上安装了该系统,在该服务器上我只是从头开始再次安装了所有 pip 包。事情似乎进展顺利,所以我做了一个pip freeze
。然后我获取了该列表并升级了服务器 A 上的软件包。
但是,正如你所料,我应该更了解。我没有在机器 B 上进行足够的测试,所以我遇到了 Pillow 版本 3.0.0 的问题。所以我降级到1.7.8版本。这解决了这个问题,错误给了我另一个问题:
File "/home/kramer65/theproject/app/models/FilterResult.py", line 26, in to_json
self.image.save(b, 'JPEG')
File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 1437, in save
save_handler(self, fp, filename)
File "/usr/local/lib/python2.7/dist-packages/PIL/JpegImagePlugin.py", line 471, in _save
ImageFile._save(im, fp, [("jpeg", (0,0)+im.size, 0, rawmode)])
File "/usr/local/lib/python2.7/dist-packages/PIL/ImageFile.py", line 476, in _save
fh = fp.fileno()
UnsupportedOperation: fileno
在这里我有点迷失了。据我所知,这是 Pillow 本身的问题,所以我不知道为什么它曾经有效以及为什么不再有效。
我在互联网上搜索,但找不到任何解决方案。
有谁知道我可以做些什么来解决这个问题?
附: PIL没有安装,所以PIL和Pillow之间不是冲突
[EDIT]
我刚刚测试了一个import Image
在 Python 中(这表明 PIL 仍然安装)。令我惊讶的是,尽管 pip 告诉我它尚未安装,但它还是成功了:
$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Image
>>> exit()
$ sudo pip uninstall PIL
The directory '/home/hielke/.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.
Cannot uninstall requirement PIL, not installed