我正在尝试运行这个:
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 x64。
同时 - Windows 10 上的 Python 2.7.15 - 可以通过以下方式添加诅咒支持:
pip install windows-curses
您只需下载库即可
pip install windows-curses
首先像这样使用pip安装curses 打开命令提示符
输入“pip install windows-curses”(仅当 pip 安装在环境变量中时才有效)
如果使用Pycharm运行curses不起作用,请尝试其他解释器应用程序,如Atom、Visual Studios,如果不起作用,请在环境变量中安装Python(链接将在底部)。然后启动 CMD 或命令提示符并输入“python(.py 文件的根目录)” (例如 python C:\Users\user\Plane.py),然后按 Enter。
在环境变量中安装 Python 的链接 - https://www.youtube.com/watch?v=1jyOHCTgWpg