Home>Article>Development Tools> A brief analysis of three methods of importing python libraries in the vscode environment

A brief analysis of three methods of importing python libraries in the vscode environment

青灯夜游
青灯夜游 forward
2022-12-14 20:20:49 4638browse

How to import python library in vscode environment? The following article will introduce to you three methods of importing python libraries invscode. I hope it will be helpful to you!

A brief analysis of three methods of importing python libraries in the vscode environment

[Recommended learning:vscode tutorial,Programming teaching]

If vscode storage location and code storage When the positions are inconsistent,I personally recommend the first method

Method 1: Configure in the vscode environment

The steps are as follows

1. Open vscode and run a string of codes. The specific installation path of python will appear below.

A brief analysis of three methods of importing python libraries in the vscode environment

That is c here The address of the disk (the address of the d disk behind is the save address of my running code, regardless of

intercept the previous part, that is,C:\Users\Rover\AppData\Local\Programs\Python\Python38- 32

2. Open the folder at the corresponding address on the computer, find the Scripts folder, enter it, and you will find a pip.exe, which is the tool used for installation.
Then copy and change Folder address: C:\Users\Rover\AppData\Local\Programs\Python\Python38-32\Scripts

A brief analysis of three methods of importing python libraries in the vscode environment
A brief analysis of three methods of importing python libraries in the vscode environment

##3. Open with win r cmd, enter -cd C:\Users\Rover\AppData\Local\Programs\Python\Python38-32\Scripts and enter the folder

A brief analysis of three methods of importing python libraries in the vscode environment

4. Install python here -pptx as an example, enter -pip install python-pptx (replace with any library name

A brief analysis of three methods of importing python libraries in the vscode environment##5. After the automatic download is successful, the following prompt will appear

End hereA brief analysis of three methods of importing python libraries in the vscode environment

Extension:

He reminded me to upgrade pip, enter the commandpython -m pip install --upgrade piporpython.exe -m pip install --upgrade pipThen

Enter the command:A brief analysis of three methods of importing python libraries in the vscode environment

Success!A brief analysis of three methods of importing python libraries in the vscode environment

Method 2: Import directly into vscodeEnter in the console

pip install option

(write the imported library name, such as import here option)

A brief analysis of three methods of importing python libraries in the vscode environment

Method 3: Use anaconda to import

    Refer to this article Article
  • Installing python library through anaconda

  • For more related knowledge about VSCode, please visit:
vscode basic tutorial

!

The above is the detailed content of A brief analysis of three methods of importing python libraries in the vscode environment. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete