我試圖運行這段代碼時:導入錯誤:沒有名爲模塊「_curses」試圖導入祝福
from blessings import Terminal
t = Terminal()
print (t.bold('Hi there!'))
print (t.bold_red_on_bright_green('It hurts my eyes!'))
with t.location(0, t.height - 1):
print ('This is at the bottom.')
這是這裏的第一個例子:https://pypi.python.org/pypi/blessings。
不過,我得到這個錯誤:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\�����\AppData\Local\Programs\Python\Python35- 32\lib\site-packages\blessings\__init__.py", line 5, in <module>
import curses
File "C:\Users\�����\AppData\Local\Programs\Python\Python35-32\lib\curses\__init__.py", line 13, in <module>
from _curses import *
ImportError: No module named '_curses'
我的系統是win10 64。
嘗試爲Windows這個[詛咒](http://www.lfd.uci.edu/~gohlke/pythonlibs/#curses)執行。 – eryksun
我在Windows 7上遇到了同樣的問題,並且正在尋找解決方法。在自述文件中提到「colorama」用於Windows的部分意味着該庫以某種方式在Windows上工作。我對Python有點新,所以我不確定在try/except構造中包裝import語句是否是一種有效的方法,但我正在研究它。此外,FYI可以確認稱爲'祝福'的'祝福'的叉具有同樣的問題(v1.6)。 –
@AdamP更新,['祝福'](https://github.com/jquast/blessed)模塊的自述文件與明確表示模塊無法工作的祝福模塊的語句略有不同Windows命令提示符: 「Blessed不提供... Windows命令提示符支持。python for windows的python for python目前僅提供部分支持 - 有計劃將ansi模塊與colorama合併以解決問題這個,補丁歡迎!「 –