无法在 Windows 版 Cygwin Python 上安装 Pillow

问题描述 投票:0回答:2

我尝试使用

pip install Pillow
通过 Cygwin 在 Windows 上安装最新版本的 Pillow,但收到错误消息:

In file included from _imagingtk.c:19:0:

/usr/include/tk.h:76:23: fatal error: X11/Xlib.h: No such file or directory

 # include <X11/Xlib.h>

                       ^

compilation terminated.

In file included from Tk/tkImaging.c:52:0:

/usr/include/tk.h:76:23: fatal error: X11/Xlib.h: No such file or directory

 # include <X11/Xlib.h>

                       ^

compilation terminated.

Building using 8 processes

gcc -shared -Wl,--enable-auto-image-base -L. build/temp.cygwin-1.7.30-x86_64-2.7/_imagingtk.o build/temp.cygwin-1.7.30-x86_64-2.7/Tk/tkImaging.o -L/usr/lib
-L/usr/lib/python2.7/config -L/usr/local/lib -L/usr/lib/python2.7/config -ltcl8.5 -ltk8.5 -lpython2.7 -o build/lib.cygwin-1.7.30-x86_64-2.7/PIL/_imagingtk.dll

gcc: error: build/temp.cygwin-1.7.30-x86_64-2.7/_imagingtk.o: No such file or directory

gcc: error: build/temp.cygwin-1.7.30-x86_64-2.7/Tk/tkImaging.o: No such file or directory

error: command 'gcc' failed with exit status 1

---------------------------------------- Cleaning up... Command /usr/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip_build_User /pillow/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-7Gv1dT-record/install-record.txt
--single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_User/pillow

Traceback (most recent call last):   File "/usr/bin/pip", line 11, in <module>
    sys.exit(main())   File "/usr/lib/python2.7/site-packages/pip/__init__.py", line 185, in main
    return command.main(cmd_args)   File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 35: ordinal not in range(128)

它失败了,因为它找不到X11,这特别令人困惑,因为我使用的是Windows计算机,而X11是Linux软件。我不喜欢依赖预编译版本,因为没有支持。

python windows pip python-imaging-library
2个回答
0
投票

对于那些仍在寻找类似问题的人,这是因为 OP 无法安装 Cygwin 中包含的许多 X11 库。是的,如果您使用 Cygwin,从某种意义上说,您正在使用“Linux”工具(它是 Windows 的独立 POSIX 兼容环境……是的,您可以用它运行 X11 服务器和客户端)。

除此之外,我当前的问题是在当前版本的 Cygwin (3.4.9) 和 Windows (11) 上的一些图形库(例如 openjpeg)......并且这是该搜索中的“热门” .


-9
投票

一如既往,这里的答案是放弃 Cygwin 并使用更好的 shell。

© www.soinside.com 2019 - 2024. All rights reserved.