简体   繁体   English

python的readline模块不适用于windows?

[英]python's readline module not available for windows?

Granted I've been off PYTHON for two + years.当然,我已经离开 PYTHON 两年多。 I'm trying to get back into the swing, and I remember having command and variable completion available on windows a few years back.我正试图回到 swing,我记得几年前 windows 上有命令和变量完成可用。 We were stuck in 2.6 as we had dependencies.我们被困在 2.6 中,因为我们有依赖关系。

Today, I'm trying to import readline.今天,我正在尝试导入 readline。 I get this message from pip.我从 pip 收到这条消息。

C:\Users\Joe>pip3 install readline Collecting readline Using cached https://files.pythonhosted.org/packages/f4/01/2cf081af8d880b44939a5f1b446551a7f8d59eae414277fd0c303757ff1b/readline-6.2.4.1.tar.gz Complete output from command python setup.py egg_info: error: this module is not meant to work on Windows C:\Users\Joe>pip3 install readline Collecting readline Using cached https://files.pythonhosted.org/packages/f4/01/2cf081af8d880b44939a5f1b446551a7f8d59eae414277fd0c303757ff1b/readline-6.2.4.1.tar.gz Complete output from command python setup.py egg_info :错误:此模块不适用于 Windows

my version is:我的版本是:

Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32 键入“帮助”、“版权”、“信用”或“许可证”了解更多信息。 import readline Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'readline'导入 readline Traceback(最近一次调用最后一次):文件“”,第 1 行,在 ModuleNotFoundError:没有名为“readline”的模块

I have recently faced the same issue on Windows 10. readline is not available for Windows, however there is pyreadline package which is for windows and you may try it.我最近在 Windows 10 上遇到了同样的问题。 readline 不适用于 Windows,但是有适用于 Windows 的 pyreadline 包,您可以尝试一下。

Try to install pyreadline and use it instead of readline :尝试安装pyreadline并使用它代替readline

$pip install pyreadline

or或者

$python -m pip install pyreadline


Then, in your python file do this:然后,在您的 python 文件中执行以下操作:

from pyreadline import Readline
readline = Readline()

That way, you can use readline in Windows like in linux systems.这样,您就可以像在 linux 系统中一样在 Windows 中使用readline

Go to your CMD terminal and type转到您的CMD终端并输入

pip install pyreadline pip 安装 pyreadline

with in few seconds it will be installed and you will be able to see message ie "Successfully installed pyreadline-"几秒钟后,它将被安装,您将能够看到消息,即“成功安装 pyreadline-”

then go back to your PYSPARK terminal and type again import readline it will import now without any error然后返回您的PYSPARK终端并再次输入 import readline它将立即导入而不会出现任何错误

Thanks谢谢

Granted I've been off PYTHON for two + years.当然,我已经离开PYTHON两年多了。 I'm trying to get back into the swing, and I remember having command and variable completion available on windows a few years back.我试图重回正轨,我记得几年前在Windows上有可用的命令和变量完成功能。 We were stuck in 2.6 as we had dependencies.由于存在依赖关系,我们陷入了2.6。

Today, I'm trying to import readline.今天,我正在尝试导入readline。 I get this message from pip.我从pip收到此消息。

C:\\Users\\Joe>pip3 install readline Collecting readline Using cached https://files.pythonhosted.org/packages/f4/01/2cf081af8d880b44939a5f1b446551a7f8d59eae414277fd0c303757ff1b/readline-6.2.4.1.tar.gz Complete output from command python setup.py egg_info: error: this module is not meant to work on Windows C:\\ Users \\ Joe> pip3 install readline使用缓存的https://files.pythonhosted.org/packages/f4/01/2cf081af8d880b44939a5f1b446551a7f8d59eae414277fd0c303757ff1b/readline-6.2.4.1.tar.gz命令python setup完整输出信息:错误:此模块不适用于Windows

my version is:我的版本是:

Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. Win32上的Python 3.7.0(v3.7.0:1bf9cc5093,Jun 27 2018,04:59:51)[MSC v.1914 64位(AMD64)]键入“帮助”,“版权”,“信用”或“许可证”想要查询更多的信息。 import readline Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'readline'导入readline Traceback(最近一次调用):FileNot“,第1行,在ModuleNotFoundError中:没有名为“ readline”的模块

I tried pyreadline after finding this question and had problems and eventually found that it is no longer supported.我在找到这个问题后尝试了 pyreadline 并遇到了问题,最终发现它不再受支持。

What worked for me was installing pyreadline3 with:对我有用的是安装 pyreadline3:

pip install pyreadline3 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM