Reputation: 43
I launched JupyterLab which is using a Python 3 kernel. However, when I am running the following commands below, it is showing different Python versions.
!python -V
Output: Python 2.7.18
from platform import python_version
print(python_version())
Output: '3.6.10'
I am expecting the Python 3.6.10 version to appear as it is the kernel that I launched/that is running. Is there a way to activate the Python 3 version whenever I run the "!python -V" command?
Upvotes: 0
Views: 868
Reputation: 1584
The original question is about python kernels so I quickly answer that. Kernels are independent of python that you run you jupyter with.
Try this command: jupyter kernelspec list
You will see your kernels. If you want to have another one here is the doc (https://ipython.readthedocs.io/en/stable/install/kernel_install.html#kernels-for-different-environments) not going deep into that as I can see this is probably not the actual problem.
It seems to me you want to change the interpretor called by "python" command.
You did not specify your OS. So in short:
Upvotes: 1