Issue
I have both Python 2 (2.7.14
) and Python 3 (3.6.4
) installed on my computer
(Linux rajarshi-x550cc 4.15.10-300.fc27.x86_64 #1 SMP Thu Mar 15 17:13:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
)
I have also installed Jupyter Notebook. When I run a new kernel on Jupyter Notebook, whether I choose to run the Python-2 kernel or the Python-3 kernel, only the Python-3 Kernel is run. I have checked this with print(sys.version)
.
I got several nice answers here on Stackoverflow, but none of them worked for me. I created a JSON file in the Jupyter library in /usr/share/jupyter/kernels/python2 with the following code:
{
"display_name": "Python 2",
"language": "python",
"argv": [
"python",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
]
}
but there was no observable difference.
I then uninstalled Jupyter from Python 3 as follows:
python3 -m pip uninstall jupyter
but Jupyter is still there, and it still recognizes only Python 3.
I am honestly at my wit's end. Should I simply remove Python 3 altogether?
Solution
You can use ipykernel
to register different versions of python in the same notebook environment.
See the following documentation for more information https://ipython.readthedocs.io/en/latest/install/kernel_install.html#kernels-for-python-2-and-3
Answered By - ScottMcC
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.