ImportError: No module named '_curses' when trying to import blessings

前端 未结 4 2110
死守一世寂寞
死守一世寂寞 2021-02-05 04:46

I am trying to run this:

from blessings import Terminal

t = Terminal()

print (t.bold(\'Hi there!\'))
print (t.bold_red_on_bright_green(\'It hurts my eyes!\'))
         


        
相关标签:
4条回答
  • 2021-02-05 05:05

    It's a known bug on windows. It has been open for 5 years, so don't hold your breath.

    The unofficial curses build is not enough since it also requires fcntl, which isn't likely to be ported anytime soon.

    • Issue #21
    0 讨论(0)
  • 2021-02-05 05:15

    First Install curses using pip like this Open Command Prompt

    type "pip install windows-curses"(This Only works if pip is installed in environmental variables)

    If running curses doesn't work using Pycharm, Try other Interpreters Apps like Atom, Visual Studios, and if that does not work, Install Python in Environmental Variables(Links will be at the bottom). Then Launch CMD or Command Prompt and type "python (the root of .py file)" (eg. python C:\Users\user\Plane.py) and then press enter.

    Link for installing Python in Environmental Variables - https://www.youtube.com/watch?v=1jyOHCTgWpg

    0 讨论(0)
  • 2021-02-05 05:22

    The curses module is not supported on Windows machines. From the module documentation:

    While curses is most widely used in the Unix environment, versions are available for DOS, OS/2, and possibly other systems as well. This extension module is designed to match the API of ncurses, an open-source curses library hosted on Linux and the BSD variants of Unix.

    Install the unofficial windows binary for curses from here and try again.

    0 讨论(0)
  • 2021-02-05 05:27

    Meanwhile - Python 2.7.15 on Windows 10 - curses support can be added by:

    pip install windows-curses
    
    0 讨论(0)
提交回复
热议问题