Python,Macports和缓冲区问题 [英] Python, Macports, and Buffer Problems

查看:130
本文介绍了Python,Macports和缓冲区问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很抱歉,如果在此发布错误的位置,我不清楚是什么问题.

Apologies if this is the wrong place to post this - I'm unclear what the problem is.

使用运行Mac OX 10.10的Macports 2.3.3构建的Python版本时,我看到了一些非常有趣的行为.我已经完全重新安装了Macports,并将其复制到iMac和Macbook Air上,并创建了一个新用户以确保它与我的环境无关.上周没有发生这种情况,在此期间的某个时候,情况发生了很大变化.

When using versions of Python built by Macports 2.3.3 running Mac OX 10.10, I'm seeing some really funny behavior. I've fully re-installed Macports, and replicated this on an iMac as well as a Macbook Air, and created a new user to make sure it wasn't something about my environment. This wasn't happening last week, and sometime in the interim something changed pretty drastically.

一切正常,直到我调用Python.

Everything works fine until I invoke Python.

$ python
Python 3.4.3 (default, Aug 26 2015, 18:29:14) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 1+1
>>> 2
^D>>> 

>>>会在输入结果之前打印,而且还会在我告诉Python使用Control-D退出之后打印.

The >>> is being printed before the result of the input, but also after I tell Python to exit with Control-D.

这时,所有输入将不再在终端中打印(iTerm2中也是如此).如果输入echo 'this is ouput; input is hidden',我唯一看到的是:

At this point, all input ceases to be printed in the terminal (the same happens in iTerm2). If I type echo 'this is ouput; input is hidden' the only thing I see is:

$ this is ouput; input is hidden

如果我重新调用解释器,事情会变得更加奇怪.

Things get even weirder if I re-invoke the interpreter.

$ Python 3.4.3 (default, Aug 26 2015, 18:29:14) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 1+1
>>> 2
^C
KeyboardInterrupt
>>> ^D
>>> exit()
>>> $ 

正在打印Control-C(不是规范),而control-D只是被忽略了-我必须键入exit才能退出提示.

Control-C is being printed (not the norm), and control-D is simply being ignored - I have to type exit to get out of the prompt.

使用reset重置终端可以解决所有问题,但是与Python解释器进行交互仍然是一场噩梦.

Resetting the terminal with reset makes all of the problems go away, but interacting with the Python interpreter is still a nightmare.

我可以在Python 2.7、3.3、3.4和3.5中复制这种行为,这使我相信我在错误的位置寻找问题.

I can replicate this behavior in Python 2.7, 3.3, 3.4, and 3.5, which leads me to believe I'm looking for the problem in the wrong place.

Python的打包安装(来自Python网站)可以正常工作,并且不会表现出这种行为.

The packaged installs of Python (from the Python website) work fine, and do not exhibit this behavior.

$ python3
Python 3.5.0 (v3.5.0:374f501f4567, Sep 12 2015, 11:00:19) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 1+1
2
>>> 
KeyboardInterrupt
>>> ^D

我很困惑.我完全不确定在哪里可以寻求此问题的帮助.我该如何找出问题所在?

I'm stumped. I'm not at all sure where to ask for help for this issue. How do I go about figuring out what the problem is?

我在Macport Trac上打开了错误报告,然后才意识到问题在这里可能会更好.

I opened a bug report on the Macport Trac before realizing the question might fare better here.

推荐答案

https://trac.macports. org/ticket/48807

似乎是一个libedit/诅咒互动.编辑端口文件以使用readline解析.希望很快会解决.

Seems to be a libedit / curses interaction. Editing the portfile to use readline resolves. Hopefully fixed soon.

这篇关于Python,Macports和缓冲区问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆