Difficulty Running Jupyter Notebook On Python2
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?
Answer
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
Related Questions
- → What are the pluses/minuses of different ways to configure GPIOs on the Beaglebone Black?
- → Django, code inside <script> tag doesn't work in a template
- → React - Django webpack config with dynamic 'output'
- → GAE Python app - Does URL matter for SEO?
- → Put a Rendered Django Template in Json along with some other items
- → session disappears when request is sent from fetch
- → Python Shopify API output formatted datetime string in django template
- → Can't turn off Javascript using Selenium
- → WebDriver click() vs JavaScript click()
- → Shopify app: adding a new shipping address via webhook
- → Shopify + Python library: how to create new shipping address
- → shopify python api: how do add new assets to published theme?
- → Access 'HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT' with Python Shopify Module