News from this site

 Rental advertising space, please contact the webmaster if you need cooperation


+focus
focused

classification  

no classification

tag  

no tag

date  

2024-11(8)

手把手教你安装Jupyter Notebook(保姆级教程)

posted on 2023-06-06 11:01     read(667)     comment(0)     like(27)     collect(0)


Introduction to Jupyter Notebook

What is Jupyter Notebook

Jupyter Notebook is a web-based interactive computing environment that supports multiple programming languages, including Python, R, Julia, and more. Its main function is to combine code, text, mathematical equations, visualizations, and other related elements to create a dynamic document for data analysis, machine learning, scientific computing, and data visualization . Jupyter Notebook provides an interactive interface that enables users to build and execute code incrementally and visually, while supporting Markdown-formatted text and LaTeX mathematical notation.

How to install Jupyter Notebook

Before installing Jupyter Notebook, you can choose to install Anaconda first . Anaconda is a distribution version that can easily obtain packages and manage packages, and can manage the environment in a unified manner. Anaconda includes more than 180 scientific packages including conda and Python and their dependencies, including Jupyter Notebook.

Of course, you can also install Jupyter Notebook through the command line pip ( you must ensure that python is installed ). The following two methods will be introduced for you.

Case 1: Install Jupyter Notebook using Anaconda

Windows system installation Anaconda

1. Download the Anaconda installation package for Windows from the Anaconda official website .
insert image description here
2. Double-click the installation package to install, select "Add Anaconda to my PATH environment variable", and then click "Install" .
click next
click next
click agree
insert image description here
Click Just Me
insert image description here
Set the installation directory(It is recommended to put it on a disk other than the c drive, it is best to create a new folder)
insert image description here
Check the first three, and the second check means adding environment variables, which will be troublesome to set later
insert image description here
clickinstall,
all the way to next
and wait for the installation.
uncheck both, click finish to complete it
insert image description here
Now open the command line and enter

conda --version

If the version information is displayed, the installation is successful.
insert image description here

3. Configure the domestic mirror source
Continue to enter the following command in cmd to configure as Tsinghua source:

conda config --add channels    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/

4. After the installation is complete, find the executable file of Navigator in the Anaconda Navigator installation directory , usually in **C:\Users\wtyyy\AppData\Roaming\Microsoft\Windows\Start Menu\Programs** file path, double-click Just open it.

Or enter the **"anaconda-navigator"** command in the Anaconda Prompt (same path as the navigator) command line window, and press Enter to start Anaconda Navigator.

In the Windows operating system, you can find the shortcut of the Anaconda Navigator application in the start menu, and click to open it.
After opening, you can see that such an interface is successful. At this time, click the launch button
insert image description here
under Jupyter Notebook .

Case 2: Install Jupyter Notebook using the pip command

First, you need to make sure that Python is installed.
1. Open the command prompt: press the Win + R keys, enter "cmd", and press the Enter key to open the command prompt window.
insert image description here
2. Install Jupyter Notebook: Enter the following command in the command prompt to install Jupyter Notebook using pip.

pip install jupyter notebook

insert image description here
3. Start Jupyter Notebook: Enter the following command in the command prompt to start Jupyter Notebook.

jupyter notebook

insert image description here
4. Next, Jupyter Notebook will open in the default browser. If it does not open automatically, you can enter http://localhost:8888/tree in the browser to access.
insert image description here
When the above page appears, the installation is successful.

Possible problems during installation

During the process of using pip to install Jupyter Notebook, you may encounter the following problems:

1. Failed to install dependent libraries : Jupyter Notebook needs to depend on other Python libraries. If any one of the dependent libraries fails to install, the installation of Jupyter Notebook will fail. At this point, you can try to use the –user parameter to reinstall the dependent library, or install it again after upgrading the pip version.
The specific method of upgrading pip is as follows. First, open the command line (win+R+cmd) and enter the command:

python -m pip install --upgrade pip

If you installed the python3 version, enter

python3 -m pip install --upgrade pip

Can be upgraded through

pip --version

To verify whether it is updated to the latest version of
python3, enter

pip3 --version

2. Slow installation speed : The process of pip installing Jupyter Notebook may require downloading and installing a large number of files. If the network speed is slow, the installation process may be very slow. At this point, you can consider changing the download source or using a proxy, or downloading the installation package directly for installation.
Tsinghua download source can be used

pip install jupyter -i https://pypi.tuna.tsinghua.edu.cn/simple

3. Installation version problem : pip may install Jupyter Notebook that is not compatible with the current system or other library versions, resulting in errors or malfunctions during runtime. At this point, you can view the official Jupyter Notebook documentation to determine the version of Jupyter Notebook that is compatible with the current system and dependent library versions, and specify the version number for installation.

4. Permission issues : In some cases, the installation process requires administrator privileges to proceed. At this point, you can open a command line window with administrator privileges for installation.

If you encounter other problems, you can try to view the error message of pip, or search for solutions to related problems in the search engine.



Category of website: technical article > Blog

Author:Abstract

link:http://www.pythonblackhole.com/blog/article/80046/6d9512d4a75b674d2c68/

source:python black hole net

Please indicate the source for any form of reprinting. If any infringement is discovered, it will be held legally responsible.

27 0
collect article
collected

Comment content: (supports up to 255 characters)