From fecaf256ef696ba8ca2f3eba4771dd44989fcdca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Herv=C3=A9=20RIVIERE?= The interpreter is compatible with Python 2 & 3.Description
-
diff --git a/python/src/main/java/org/apache/zeppelin/python/PythonInterpreter.java b/python/src/main/java/org/apache/zeppelin/python/PythonInterpreter.java
index f64bcb620e..db7e15dcfc 100644
--- a/python/src/main/java/org/apache/zeppelin/python/PythonInterpreter.java
+++ b/python/src/main/java/org/apache/zeppelin/python/PythonInterpreter.java
@@ -42,8 +42,8 @@ public class PythonInterpreter extends Interpreter {
public static final String BOOTSTRAP_PY = "/bootstrap.py";
public static final String BOOTSTRAP_INPUT_PY = "/bootstrap_input.py";
- public static final String PYTHON_PATH = "python.path";
- public static final String DEFAULT_PYTHON_PATH = "/usr/bin/python";
+ public static final String PYTHON_PATH = "python";
+ public static final String DEFAULT_PYTHON_PATH = "python";
private String pythonPath;
private Integer port;
@@ -59,13 +59,13 @@ public class PythonInterpreter extends Interpreter {
static {
Interpreter.register(
- "python",
- "python",
- PythonInterpreter.class.getName(),
- new InterpreterPropertyBuilder()
- .add(PYTHON_PATH, DEFAULT_PYTHON_PATH,
- "Python path. Default : /usr/bin/python")
- .build()
+ "python",
+ "python",
+ PythonInterpreter.class.getName(),
+ new InterpreterPropertyBuilder()
+ .add(PYTHON_PATH, DEFAULT_PYTHON_PATH,
+ "Python directory. Default : python (assume python is in your $PATH)")
+ .build()
);
}
@@ -151,7 +151,7 @@ public class PythonInterpreter extends Interpreter {
String output = sendCommandToPython(cmd);
return new InterpreterResult(Code.SUCCESS, output.replaceAll(">>>", "")
- .replaceAll("\\.\\.\\.", "").trim());
+ .replaceAll("\\.\\.\\.", "").trim());
}
@@ -183,7 +183,7 @@ public class PythonInterpreter extends Interpreter {
@Override
public Scheduler getScheduler() {
return SchedulerFactory.singleton().createOrGetParallelScheduler(
- PythonInterpreter.class.getName() + this.hashCode(), 10);
+ PythonInterpreter.class.getName() + this.hashCode(), 10);
}
@Override
@@ -239,7 +239,7 @@ public class PythonInterpreter extends Interpreter {
BufferedReader bootstrapReader = new BufferedReader(
new InputStreamReader(
- PythonInterpreter.class.getResourceAsStream(file)));
+ PythonInterpreter.class.getResourceAsStream(file)));
String line = null;
String bootstrapCode = "";
while ((line = bootstrapReader.readLine()) != null)
diff --git a/python/src/main/resources/bootstrap.py b/python/src/main/resources/bootstrap.py
index ffc4ca4747..ee199f4710 100644
--- a/python/src/main/resources/bootstrap.py
+++ b/python/src/main/resources/bootstrap.py
@@ -40,8 +40,8 @@ def help():
print ('python.path
- /usr/bin/python
- Path of the already installed Python binary (could be python2 or python3)
+ python
+ python
+ Path of the already installed Python binary (could be python2 or python3).
+ If python is not in your $PATH you can set the absolute directory (example : /usr/bin/python)
+
Python 2 & 3 comptability
')
print ('
')
print ('To change Python version, ')
- print ('change in the interpreter configuration the python.path to the ')
- print ('desired version (example : python.path=/usr/bin/python3)
The interpreter can use all modules already installed ') print ('(with pip, easy_install, etc)
')