Python,Macports和缓冲区问题

安德鲁·平克汉姆

抱歉,如果这是张贴此内容的错误位置,则不知道是什么问题。

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

一切正常,直到我调用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与控制-d退出。

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

$ this is ouput; input is hidden

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

$ 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以退出提示。

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

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

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

$ 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

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

在意识到这个问题可能会更好之前,在Macport Trac上打开了一个错误报告

埃博里施

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

似乎是一个libedit / curses互动。编辑端口文件以使用readline解析。希望很快修复。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章