Home > Article > Backend Development > Install both python2 and python3 in jupyter notebook
I have discussed installing multiple python versions under anaconda before. In this issue, we will discuss how to install python2.7 and python3.x at the same time in jupyter notebook.
Since the jupyter notebook I used before was based on the python3.5 version, I only need to install the python2.7-based kernel on this basis.
My environment is as follows:
windows 7, 64-bit system
Anaconda based on python3.5 version has been installed
The virtual environments of py27 and py36 have been installed in anaconda
The existing jupyter notebook kernel is based on the python3.5 version
In jupyter notebook, select a different python version, called kernel. When installing, just install ipykernel.
In the previous article, I installed anaconda's virtual environment py27 in the specified path (D:\pyenv\py27), so when installing ipykernel, I also need to specify the installation. The installation command is "conda install --prefix=D:\pyenv\py27 ipykernel", as follows:
Then activate the virtual environment of py27 and enter the command:
python -m ipykernel install --user
##Start jupyter notebook to check. At this time, you can see that the python2 kernel has been installed.
A little trick to quickly start jupyter notebook
In the path of the folder you want to open, create a file with the suffix ".bat" (for example, named ipy.bat), open the file with Notepad, enter the following content and save it.
rem -- start_ipython_notebook_here.bat ---<span style="color: #000000;"> dir jupyter notebook pause</span>
Extended reading:
The above is the detailed content of Install both python2 and python3 in jupyter notebook. For more information, please follow other related articles on the PHP Chinese website!