是否可以让我的 Windows Python 安装知道在 Cygwin 终端内 运行 时它可以使用的额外库?
Is it possible to make my Windows Python installation aware of extra libraries it can use when running inside a Cygwin terminal?
我想使用以下 Python 包,它需要 ncurses
:https://pypi.python.org/pypi/blessings
我安装了 Windows 版本的 Anaconda Python,并指定为我的 Python 发行版。
我也有一个 Cygwin 安装。当我在提供的 Cygwin 终端中 运行 python -i
时,Anaconda Python 启动——太棒了!
如果我随后尝试 import blessings
,我将收到以下错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "A:\anaconda\lib\site-packages\blessings\__init__.py", line 5, in <module>
import curses
File "A:\anaconda\lib\curses\__init__.py", line 15, in <module>
from _curses import *
ImportError: No module named _curses
好吧,现在发生的事情是 Anaconda Python 没有接受 Cygwin 的诅咒,这是可以理解的。
现在,仅在 Cygwin 终端的使用上下文中尝试并以某种方式让 Anaconda 知道 ncurses
是否有意义?我怀疑不是,而且我在概念上遗漏了什么?
很遗憾,您将无法将 Cygwin Python 的 curses 模块与 CPython 一起使用。由于以下原因(以及更多),两个 Python 的模块不兼容:
Windows Python 直接调用 Win32 API(通过 Visual Studio 2008、2010 或 2015 C-Runtimes),而 Cygwin Python 链接到位于 Visual Studio 6.0 C-Runtime 之上的 Cygwin POSIX API。在单个进程中混合不同的 C 运行时是一个非常糟糕的主意:http://siomsystems.com/mixing-visual-studio-versions/,更不用说通过 POSIX API.
进一步抽象了
无论 C 运行时差异如何,Cygwin 实现 LP64 模型,而 Windows 实现 LLP64 模型,这将使 long
的 64 位大小在每个模型之间不同,因此某些结构可以大小不同。由于代码中的#ifdefs,它们可能无论如何都是。
你有什么理由不能使用colorama吗?
blessings 的文档表明这应该有效。
我想使用以下 Python 包,它需要 ncurses
:https://pypi.python.org/pypi/blessings
我安装了 Windows 版本的 Anaconda Python,并指定为我的 Python 发行版。
我也有一个 Cygwin 安装。当我在提供的 Cygwin 终端中 运行 python -i
时,Anaconda Python 启动——太棒了!
如果我随后尝试 import blessings
,我将收到以下错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "A:\anaconda\lib\site-packages\blessings\__init__.py", line 5, in <module>
import curses
File "A:\anaconda\lib\curses\__init__.py", line 15, in <module>
from _curses import *
ImportError: No module named _curses
好吧,现在发生的事情是 Anaconda Python 没有接受 Cygwin 的诅咒,这是可以理解的。
现在,仅在 Cygwin 终端的使用上下文中尝试并以某种方式让 Anaconda 知道 ncurses
是否有意义?我怀疑不是,而且我在概念上遗漏了什么?
很遗憾,您将无法将 Cygwin Python 的 curses 模块与 CPython 一起使用。由于以下原因(以及更多),两个 Python 的模块不兼容:
Windows Python 直接调用 Win32 API(通过 Visual Studio 2008、2010 或 2015 C-Runtimes),而 Cygwin Python 链接到位于 Visual Studio 6.0 C-Runtime 之上的 Cygwin POSIX API。在单个进程中混合不同的 C 运行时是一个非常糟糕的主意:http://siomsystems.com/mixing-visual-studio-versions/,更不用说通过 POSIX API.
进一步抽象了无论 C 运行时差异如何,Cygwin 实现 LP64 模型,而 Windows 实现 LLP64 模型,这将使 long
的 64 位大小在每个模型之间不同,因此某些结构可以大小不同。由于代码中的#ifdefs,它们可能无论如何都是。
你有什么理由不能使用colorama吗? blessings 的文档表明这应该有效。