我在Mac OS X 10.11.3上我的终端看起来像这样:
[Fabian@MacBook-Pro] >
[Fabian@MacBook-Pro] > pyspark
Python 2.7.11 (default, Jan 29 2016, 17:48:19)
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
16/03/17 10:08:22 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/__ / .__/\_,_/_/ /_/\_\ version 1.6.1
/_/
Using Python version 2.7.11 (default, Jan 29 2016 17:48:19)
SparkContext available as sc, HiveContext available as sqlContext.
>>> print 'hello'
>>> hello
>>> quit()
>>> [Fabian@MacBook-Pro] > [Fabian@MacBook-Pro] > [Fabian@MacBook-Pro] > [Fabian@MacBook-Pro] > -bash: printsf: command not found
在第一行我输入,如你所见,提示从另一行开始,然后我启动pyspark,做一些事情然后退出,然后当我返回提示时按Enter键,你可以看到,提示不会出现在换行符中!我实际输入并且没有任何内容打印到屏幕上,但是命令会按照您的操作执行
-bash: printsf: command not found
我的.bash_profile(位于/ Users / Fabian文件夹中)看起来像这样
# Setting PATH for Python 3.4
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export PYTHONPATH=$PYTHONPATH:/Users/Fabian/Library/Python
##
# Your previous /Users/Fabian/.bash_profile file was backed up as /Users/Fabian/.bash_profile.macports-saved_2016-02-07_at_11:26:24
##
# MacPorts Installer addition on 2016-02-07_at_11:26:24: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=$PATH:/Users/Fabian/apache-maven-3.3.9/bin
export PS1="[\u@\h] > "
export PATH=$PATH:/Users/Fabian/spark-1.6.1-bin-hadoop2.6/bin
我该如何解决这个问题? 谢谢!
答案 0 :(得分:9)
正如评论中所述(以及OP所描述的),每条消息丢失后的预期换行符。这是因为应用程序改变了处理回车/换行的终端I / O模式,例如,
然而,在"任何"键盘,您可以按 control J 键入换行符。通常的修复应用首先按 control J 以获得提示,并按 control J 完成命令:
答案 1 :(得分:0)
这可能是由一个转义字符引起的,当打印到终端时会导致它变硬。
如果您关闭此终端窗口并打开一个新窗口通常会有所帮助。也许dumb
正在使用一些转义码(用于颜色或设计),然后忘记恢复其更改。
您可以尝试使用终端类型xterm-256color
而不是$TERM
运行echo $TERM
。这可以通过pyspark
环境变量完成。在运行@Output
之前尝试执行valueChange
。
答案 2 :(得分:0)
我在使用macport安装的python 2.7.12时遇到了同样的问题。这可能是巧合,因为我尝试过很多东西,但“sudo port install py27-readline”为我解决了这个问题。