Jupyter Lab

How to know which is running in Jupyter notebook ?

StackOverflow GitHub

1
2
3
4

from platform import python_version

print(python_version())

This will give you the exact version of python running your script. eg output:

1
3.6.5
1
2
import sys
sys.executable

will give you the interpreter. You can select the interpreter you want when you create a new notebook. Make sure the path to your anaconda interpreter is added to your path (somewhere in your bashrc/bash_profile most likely).

For example I have the following line in my .bash_profile :

1
export PATH="$HOME/anaconda3/bin:$PATH"
1
2
3
4
5
6
7

import sys
print(sys.executable)
print(sys.version)
print(sys.version_info)