Tab在python3.6中不工作,在Windows上的3.5、3.6 32位版本中工作

2024-05-18 12:33:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我的电脑上安装了几个版本的python。在windows命令提示符中键入py时,默认启动的是:

Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)] on win32

当我点击标签时,我得到了这个错误:

Traceback (most recent call last): File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\pyreadline\console\console.py", line 768, in hook_wrapper_23 res = ensure_str(readline_hook(prompt)) File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\pyreadline\rlmain.py", line 571, in readline self._readline_from_keyboard() File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\pyreadline\rlmain.py", line 536, in _readline_from_keyboard if self._readline_from_keyboard_poll(): File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\pyreadline\rlmain.py", line 556, in _readline_from_eyboard_poll result = self.mode.process_keyevent(event.keyinfo) File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\pyreadline\modes\emacs.py", line 243, in process_keyevent r = self.process_keyevent_queue-1 File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\pyreadline\modes\emacs.py", line 286, in _process_keyevent r = dispatch_func(keyinfo) File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\pyreadline\modes\basemode.py", line 257, in complete completions = self._get_completions() File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\pyreadline\modes\basemode.py", line 200, in _get_completions r = self.completer(ensure_unicode(text), i) File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\rlcompleter.py", line 80, in complete readline.redisplay() AttributeError: module 'readline' has no attribute 'redisplay'

当我启动不同的python版本时,不会出现相同的错误。在

C:\Users\User\AppData\Local\Programs\Python\Python36-32>python.exe Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.

>>>

这是怎么回事?我希望能够在我的普通python版本中再次使用tab。任何帮助将不胜感激!在


Tags: inpyreadlinelibpackageslocallinesite
1条回答
网友
1楼 · 发布于 2024-05-18 12:33:26

针对Windows 10的测试解决方案?‍?

原来的帖子是there。在

  • 在? 复制上次回溯文件路径C:\Users\User\AppData\Local\Programs\Python\Python36\lib\rlcompleter.py
  • 用任何文本编辑器打开它?
    • 如果有VsCode,请使用cmd并复制此? 在
    • code C:\Users\User\AppData\Local\Programs\Python\Python36\lib\rlcompleter.py
  • 在? 看看追溯告诉我们的line 80
  • 像下面这样更改这些行(开始79),它将起作用? 在
...
if _readline_available:                     ## The old one is ##
    if hasattr(readline, 'redisplay'):      # if _readline_available:
        readline.insert_text('\t')          #     readline.insert_text('\t')
        readline.redisplay()                #     readline.redisplay()
    return ''                               # return ''
...

⚠ Do not forget to relaunch your python terminal

相关问题 更多 >

    热门问题