= get_ipython().__class__.__name__ == 'ZMQInteractiveShell'
is_jupyter is_jupyter
True
To add existing environment as a jupyter kernel:
List kernels
Remove kernel
Install new kernel
Go to global VSCode settings (Cmd + ,) and search for Jupyter Notebook File Root
, then set it to any path you like to be imported by default.
Go to kernel.json
file:
add PYTHONPATH
environmental variable in the env
section:
{
"argv": [
"/path/to/custom/python",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"env": {
"PYTHONPATH": "/path/to/custom/path"
},
Note PYTHONPATH
has nothing to do with the path to the python file set in argv.
To add a global path to all kernels we can use ipython_config.py
file:
/Users/username/.ipython
add these lines (use i
to enter insert mode and Esc
to exit, save and quit as :wq
:
One can always get the current folder in the notebook a = os.path.abspath('')
and then manipulate it. Manually setting up some ENV path variable is also an option. Magic command for environemtal variables:
%env
In jupyter config file modify and uncomment following line: c.MultiKernelManager.default_kernel_name='newDefault' \n"