是否有構建簡單Python命令提示符界面的方法?它只需要輸入文本和輸出內容。構建Python命令提示符界面
到底界面應該看的東西是:
從2017年Pycharm我得到這些錯誤。
Traceback (most recent call last): File "C:/Users/Main/Desktop/Py Sandbox/Keylogger/test.py", line 4, in user_input = prompt('>') File "C:\Users\Main\AppData\Local\Programs\Python\Python35\lib\site-packages\prompt_toolkit\shortcuts.py", line 548, in prompt eventloop=eventloop) File "C:\Users\Main\AppData\Local\Programs\Python\Python35\lib\site-packages\prompt_toolkit\shortcuts.py", line 576, in run_application output=create_output(true_color=true_color)) File "C:\Users\Main\AppData\Local\Programs\Python\Python35\lib\site-packages\prompt_toolkit\shortcuts.py", line 118, in create_output return Win32Output(stdout) File "C:\Users\Main\AppData\Local\Programs\Python\Python35\lib\site-packages\prompt_toolkit\terminal\win32_output.py", line 80, in init info = self.get_win32_screen_buffer_info() File "C:\Users\Main\AppData\Local\Programs\Python\Python35\lib\site-packages\prompt_toolkit\terminal\win32_output.py", line 172, in get_win32_screen_buffer_info raise NoConsoleScreenBufferError prompt_toolkit.terminal.win32_output.NoConsoleScreenBufferError: No Windows console found. Are you running cmd.exe?
而且從默認的Python IDLE我得到這個eroor:
Traceback (most recent call last): File "C:/Users/Main/Desktop/adusgisdhui.py", line 4, in user_input = prompt('>') File "C:\Users\Main\AppData\Local\Programs\Python\Python35\lib\site-packages\prompt_toolkit\shortcuts.py", line 548, in prompt eventloop=eventloop) File "C:\Users\Main\AppData\Local\Programs\Python\Python35\lib\site-packages\prompt_toolkit\shortcuts.py", line 576, in run_application output=create_output(true_color=true_color)) File "C:\Users\Main\AppData\Local\Programs\Python\Python35\lib\site-packages\prompt_toolkit\shortcuts.py", line 118, in create_output return Win32Output(stdout) File "C:\Users\Main\AppData\Local\Programs\Python\Python35\lib\site-packages\prompt_toolkit\terminal\win32_output.py", line 80, in init info = self.get_win32_screen_buffer_info() File "C:\Users\Main\AppData\Local\Programs\Python\Python35\lib\site-packages\prompt_toolkit\terminal\win32_output.py", line 162, in get_win32_screen_buffer_info self.flush() File "C:\Users\Main\AppData\Local\Programs\Python\Python35\lib\site-packages\prompt_toolkit\terminal\win32_output.py", line 288, in flush self.stdout.flush() AttributeError: 'NoneType' object has no attribute 'flush'
你不需要一個單獨的模塊。 「輸入」功能是一個內置的功能。 –
[Python:user input and commandline arguments]可能的重複(http://stackoverflow.com/questions/70797/python-user-input-and-commandline-arguments) –
可能的重複[如何在Python中編寫shell ](http://stackoverflow.com/questions/2594560/how-to-write-a-shell-in-python) – KronoS