About several methods of installing and uninstalling Python modules, the first one is commonly used by beginners...

Brothers often fail to install modules when they encounter modules, or get confused when they encounter errors, which delays the learning progress. Today, we will learn about several methods of installing modules in Python at one time~

First, the command prompt window installation and uninstallation

1. Installation

The first, the most commonly used method, is basically used by beginners, and it is installed directly in cmd.

First, press and hold win+r on the keyboard

and the run box will pop up,

then enter cmd


After pressing OK, a command prompt window will pop up.
Let's take the common crawler module requests as an example, requests is a data request module.

Enter pip install requests in the command prompt window to install successfully.

The last sentence is to prompt the successful installation of the requests module of version 2.27.1.

Note: pip is a Python package management tool that provides functions for finding, downloading, installing, and uninstalling Python packages.

2. View the installation

Let's check the installation, enter pip list and press Enter to view, pip list is to check which third-party libraries are installed in Python.
Or enter pip freeze and press Enter to view, pip freeze is to view all installed modules.
Or the list looks refreshing, and if there is no need to use freeze, we can just use the list.

3. Uninstall

Or take requests as an example

Enter pip uninstall requests in the command prompt window and press Enter

Enter Y to agree to uninstall, enter n to disagree to uninstall, here we enter Y.

Seeing that Successfully is the currently installed version 2.27.1 has been uninstalled.

There are also two uninstall methods, but I personally feel that the use is not that big, and I will write it up to make up the number of words, so I will not write it.

2. Install and uninstall through pip in pycharm

This is similar to the first one, but if you are typing code with pycharm, it is more convenient and you don't need to open so many windows.

1. Installation

First open pycharm, then see the terminal in the lower left corner,
click the terminal, and the interface will pop up. The
rest of the interface is the same as in the command prompt window.

Enter pip install requests and press Enter to install

2. Uninstall

Enter pip uninstall requests and press y to complete the uninstallation

3. Install and uninstall in pycharm settings

This is relatively simple, but many people don't use it.

1. Installation
First open pycharm, click file, click settings,

click plugins, click marketplace, click the search box, and enter the module you want to install.
Requests is used as an example.

Click install to install successfully

Click installed to view the installation, you can see the picture below, here we have successfully installed.

2. Uninstall

Uninstallation is easier, just click Restart IDE behind the module to complete the installation.

insert image description here
Then click restart to restart pycharm


Brothers, there are so many sharings today, remember to like, forward and favorite!

Guess you like

Origin blog.csdn.net/fei347795790/article/details/123487417