Install both python2 and python3 in jupyter notebook

PHP中文网
Release: 2017-06-30 09:20:24
Original
2842 people have browsed it

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

Install the py27 kernel based on the py35 kernel

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

When starting jupyter notebook, you have to switch the file path every time and enter relevant commands, which is relatively troublesome. There is a little trick that can be used to start quickly. This is what I usually use.

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>
Copy after login
In the future, double-click this ipy.bat file to quickly start jupyter notebook. I usually send this ipy.bat file to the desktop as a shortcut (a purely lazy approach).

Extended reading:

  1. Anaconda installs the virtual environment to the specified path

  2. Top 10 cities for python job hunting, let’s see if your city is included

  3. 5 minutes to master Zhaopin recruitment website crawling and saving to MongoDB database

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!