7 votos

Usando python tornillos de la carcasa (y/o terminal?)!

El problema

Simplemente la apertura y el cierre de la Python sub-shell tornillos hasta mi concha (o posiblemente el terminal?). Parece quitar la cáscara de la capacidad de imprimir cualquier texto que escriba, incluyendo saltos de línea después de que me introduzca un comando.

El problema se produce para python3.4, python2.7, y python2.6, pero no para python2.5.

Esto no ha ocurrido antes (que me he dado cuenta), y no sucede en otros paquetes de software que he usado (VIM, Emacs, etc.).

He confirmado que rompe con Apple Terminal estándar (Versión 2.2.3 [303.2]), iTerm2 (compilación 2.1.1), y XTerm (269).

Curiosamente, en el que se rompe bajo bash, pero no zsh o csh.

Ejemplo de comportamiento

Para demostrar, hago lo siguiente ($SHELL es /bin/bash):

  1. Ejecutar which python3.4.
  2. Ejecutar python3.4.
  3. Pulsar la tecla de Retorno una vez, a continuación, escriba exit() en el interprete de Python.
  4. Pulse la tecla de Retorno de dos veces más.
  5. Escriba python3.4 --version.

He aquí lo que yo veo por algunos de los principales versiones de Python que tengo instalado:

Python3.4 -- problemática

myself@localhost:~$ which python3.4
python3.4 is /opt/local/bin/python3.4
python3.4 is /opt/local/bin/python3.4
myself@localhost:~$ python3.4
Python 3.4.3 (default, Aug 24 2015, 17:25:38)
[GCC 4.2.1 Compatible Apple Clang 3.0 (tags/Apple/clang-211.12)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> exit()
>>> myself@localhost:~$ myself@localhost:~$ myself@localhost:~$ Python 3.4.3
myself@localhost:~$

Python2.7 -- problemática

myself@localhost:~$ which python2.7
python2.7 is /opt/local/bin/python2.7
python2.7 is /usr/local/bin/python2.7
python2.7 is /usr/bin/python2.7
python2.7 is /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
python2.7 is /usr/bin/python2.7
python2.7 is /usr/local/bin/python2.7
python2.7 is /opt/local/bin/python2.7
myself@localhost:~$ python2.7
Python 2.7.10 (default, Aug 24 2015, 11:54:49)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> exit()
>>> myself@localhost:~$ myself@localhost:~$ myself@localhost:~$ Python 2.7.10
myself@localhost:~$

Python2.6 -- problemática

myself@localhost:~$ which python2.6
python2.6 is /opt/local/bin/python2.6
python2.6 is /usr/bin/python2.6
python2.6 is /usr/bin/python2.6
python2.6 is /opt/local/bin/python2.6
myself@localhost:~$ python2.6
Python 2.6.9 (unknown, Aug 24 2015, 17:53:21)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> exit()
>>> myself@localhost:~$ myself@localhost:~$ myself@localhost:~$ Python 2.6.9
myself@localhost:~$

Python2.5 -- funciona!

myself@localhost:~$ which python2.5
python2.5 is /usr/bin/python2.5
python2.5 is /usr/bin/python2.5
myself@localhost:~$ python2.5
Python 2.5.6 (r256:88840, Jul 31 2011, 19:30:45)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> exit()
myself@localhost:~$
myself@localhost:~$
myself@localhost:~$ python2.5 --version
Python 2.5.6
myself@localhost:~$

Ejecución en zsh o csh parece que funciona muy bien:

Zsh

myself@localhost:~$ zsh
localhost% which python3.4
/opt/local/bin/python3.4
localhost%
localhost% python3.4
Python 3.4.3 (default, Aug 24 2015, 17:25:38)
[GCC 4.2.1 Compatible Apple Clang 3.0 (tags/Apple/clang-211.12)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> exit()
>>> %                                                                           
ra%
ra%
ra% python3.4 --version
Python 3.4.3
localhost% exit
myself@localhost:~$

Csh

myself@localhost:~$ csh
Running csh
[localhost:~] myself% which python3.4
/opt/local/bin/python3.4
[localhost:~] myself% python3.4
Python 3.4.3 (default, Aug 24 2015, 17:25:38)
[GCC 4.2.1 Compatible Apple Clang 3.0 (tags/Apple/clang-211.12)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> exit()
>>> [localhost:~] myself%
[localhost:~] myself%
[localhost:~] myself% python3.4 --version
Python 3.4.3
[localhost:~] myself% exit
exit

Mi pensamiento hasta el momento:

El hecho de que el comportamiento parece ser el mismo para los tres terminales me hace pensar que no es un terminal problema.

El hecho de que funciona en Zsh y Csh, pero no en Bash que me hace pensar que es un shell problema.

El hecho de que las versiones que se rompen (3.4, 2.7, 2.6) se instalan bajo /opt/local/bin/ (MacPorts habitual de la ubicación de la instalación), pero la versión que funciona (2.5) está instalado en /usr/bin/, me pregunto si algunos de los recientes MacPorts actualización (empujado tal vez hasta 20 días antes de Agosto. 24, 2015??) puede haber roto algo que hace Python y Bash no trabajar juntos!

10voto

yoliho Puntos 340

No parece ser un problema con los recientes Macports versiones de python ver este error

Una solución es instalar pyXX-readline (py35-readline ha sido producido por este error)

Otra es instalar python addding la +readline variante

AppleAyuda.com

AppleAyuda es una comunidad de usuarios de los productos de Apple en la que puedes resolver tus problemas y dudas.
Puedes consultar las preguntas de otros usuarios, hacer tus propias preguntas o resolver las de los demás.

Powered by:

X