{"id":1177,"date":"2022-11-09T13:21:01","date_gmt":"2022-11-09T13:21:01","guid":{"rendered":"https:\/\/262235.xyz\/?p=1177"},"modified":"2022-11-09T13:21:01","modified_gmt":"2022-11-09T13:21:01","slug":"1177","status":"publish","type":"post","link":"https:\/\/lyvba.com\/index.php\/2022\/11\/09\/1177\/","title":{"rendered":"\u4fee\u590d Python 3.11 \u5728 Windows 11 \u4f7f\u7528 pyreadline \u9519\u8bef"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/lyvba.com\/wp-content\/uploads\/2021\/11\/842700694.webp\" alt=\"\" title=\"\"><\/p>\n<h2>Python \u81ea\u52a8\u8865\u5168\u6a21\u5757 readline \u89e3\u6790<\/h2>\n<p>readline\u6a21\u5757\u5b9a\u4e49\u4e86\u4e00\u7cfb\u5217\u51fd\u6570\u7528\u6765\u8bfb\u5199Python\u89e3\u91ca\u5668\u4e2d\u5386\u53f2\u547d\u4ee4\uff0c\u5e76\u63d0\u4f9b\u81ea\u52a8\u8865\u5168\u547d\u4ee4\u529f\u80fd\u3002\u8fd9\u4e2a\u6a21\u5757\u53ef\u4ee5\u901a\u8fc7relcompleter\u6a21\u5757\u76f4\u63a5\u8c03\u7528\uff0c\u6a21\u5757\u4e2d\u7684\u8bbe\u7f6e\u4f1a\u5f71\u54cd\u89e3\u91ca\u5668\u4e2d\u7684\u4ea4\u4e92\u63d0\u793a\uff0c\u4ee5\u53ca\u5185\u7f6e\u51fd\u6570raw_input()\u548cinput()\u63d0\u4f9b\u7684\u63d0\u793a\u3002<br \/>readline\u6a21\u5757\u5b9a\u4e49\u4e86\u4ee5\u4e0b\u65b9\u6cd5\uff1a \u8f93\u5165 readline. \u7136\u540e\u6309 TAB \u5c31\u80fd\u81ea\u52a8\u8865\u5168\u663e\u793a<\/p>\n<h2>Python 3.10 \u548c 3.11 \u5728 Windows 11 \u4f7f\u7528 pyreadline \u5e93\u4f1a\u5982\u4e0b\u9519\u8bef<\/h2>\n<pre><code>Python 3.10.5 (tags\/v3.10.5:f377153, Jun  6 2022, 16:14:13) [MSC v.1929 64 bit (AMD64)] on win32\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\nFailed calling sys.__interactivehook__\nTraceback (most recent call last):\n  File \"C:UsersvipAppDataLocalProgramsPythonPython310libsite.py\", line 446, in register_readline\n    import readline\n  File \"C:UsersvipAppDataLocalProgramsPythonPython310libsite-packageseadline.py\", line 34, in &lt;module&gt;\n    rl = Readline()\n  File \"C:UsersvipAppDataLocalProgramsPythonPython310libsite-packagespyreadlinelmain.py\", line 422, in __init__\n    BaseReadline.__init__(self)\n  File \"C:UsersvipAppDataLocalProgramsPythonPython310libsite-packagespyreadlinelmain.py\", line 62, in __init__\n    mode.init_editing_mode(None)\n  File \"C:UsersvipAppDataLocalProgramsPythonPython310libsite-packagespyreadlinemodesemacs.py\", line 633, in init_editing_mode\n    self._bind_key('space',       self.self_insert)\n  File \"C:UsersvipAppDataLocalProgramsPythonPython310libsite-packagespyreadlinemodes\basemode.py\", line 162, in _bind_key\n    if not callable(func):\n  File \"C:UsersvipAppDataLocalProgramsPythonPython310libsite-packagespyreadlinepy3k_compat.py\", line 8, in callable\n    return isinstance(x, collections.Callable)\nAttributeError: module 'collections' has no attribute 'Callable'<\/code><\/pre>\n<h2>\u4ece\u9879\u76ee <a href=\"https:\/\/github.com\/hongwenjun\/pyreadline\">https:\/\/github.com\/hongwenjun\/pyreadline<\/a> \u4e0b\u8f7d\u6e90\u7801\u5305\uff0c\u4fee\u6539\u66ff\u6362\u4e24\u4e2a\u6587\u4ef6\uff0c\u8fbe\u5230\u4e0d\u62a5\u9519\u8bef\u7684\u529f\u6548<\/h2>\n<pre><code>modified:   pyreadline\/lineeditor\/history.py\nmodified:   pyreadline\/py3k_compat.py<\/code><\/pre>\n<h2><a href=\"https:\/\/lyvba.com\/index.php\/archives\/664\/\">\u7ed9VSCode\u7ec8\u7aef\u4e00\u70b9\u989c\u8272\u770b\u770b: Python \u89e3\u91ca\u5668\u4ea4\u4e92\u6a21\u5f0f\u67e5\u770b\u6574\u4e2a\u547d\u4ee4\u5386\u53f2<\/a><\/h2>\n<p><img decoding=\"async\" src=\"https:\/\/lyvba.com\/wp-content\/uploads\/2021\/11\/2172231727.gif\" alt=\"\" title=\"\"><\/p>\n<h2>python windows \u5b89\u88c5 readline \u6a21\u5757<\/h2>\n<pre><code>python -m pip install pyreadline\n# \u4e0d\u80fd\u76f4\u63a5\u7528pip install pyreadline<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/lyvba.com\/wp-content\/uploads\/2021\/11\/2036123219.png\" alt=\"\" title=\"\"><\/p>\n<h2>Python \u4ea4\u4e92\u6a21\u5f0f \u5386\u53f2\u547d\u4ee4\u3001\u6e05\u5c4f\u548c\u8c03\u7528Shell\u6a21\u5757<\/h2>\n<ul>\n<li>\n<p>\u6e90\u7801: <a href=\"https:\/\/git.io\/me.py\">git.io\/me.py<\/a><\/p>\n<pre><code>:: Usage:  python -i me.py     or [import me] , import the module me.py\n:: Function:  cls()  ls()  cd(path)  cat(file)  pwd()  bash()  info()  history()<\/code><\/pre>\n<\/li>\n<\/ul>\n<p>==========<\/p>\n<h1>pyreadline<\/h1>\n<p>The pyreadline package is a python implementation of GNU readline functionality<br \/>it is based on the ctypes based UNC readline package by Gary Bishop. <br \/>It is not complete. It has been tested for use with windows 2000 and windows xp.<\/p>\n<p>Version 2.0 runs on Python 2.6, 2.7, and &gt;3.2 using the same code.<\/p>\n<p>Features:<\/p>\n<ul>\n<li>keyboard text selection and copy\/paste<\/li>\n<li>Shift-arrowkeys for text selection<\/li>\n<li>Control-c can be used for copy activate with allow_ctrl_c(True) in config file<\/li>\n<li>Double tapping ctrl-c will raise a KeyboardInterrupt, use ctrl_c_tap_time_interval(x)<br \/>where x is your preferred tap time window, default 0.3 s.<\/li>\n<li>paste pastes first line of content on clipboard.<\/li>\n<li>ipython_paste, pastes tab-separated data as list of lists or numpy array if all data is numeric<\/li>\n<li>paste_mulitline_code pastes multi line code, removing any empty lines.<\/li>\n<\/ul>\n<p>The latest development version is always available at the IPython git <br \/> repository_.<\/p>\n<p>.. _repository: <a href=\"https:\/\/github.com\/pyreadline\/pyreadline.git\">https:\/\/github.com\/pyreadline\/pyreadline.git<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python \u81ea\u52a8\u8865\u5168\u6a21\u5757 readline \u89e3\u6790 readline\u6a21\u5757\u5b9a\u4e49\u4e86\u4e00\u7cfb\u5217\u51fd\u6570\u7528\u6765\u8bfb\u5199Py [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[45],"class_list":["post-1177","post","type-post","status-publish","format-standard","hentry","category-learn","tag-python"],"_links":{"self":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1177","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/comments?post=1177"}],"version-history":[{"count":0,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1177\/revisions"}],"wp:attachment":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/media?parent=1177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/categories?post=1177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/tags?post=1177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}