Home >Development Tools >VSCode >How to import python library in vscode? Three ways to share

How to import python library in vscode? Three ways to share

青灯夜游
青灯夜游forward
2022-03-22 20:09:3715412browse

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

How to import python library in vscode? Three ways to share

[Recommended study: "vscode introductory tutorial"]

If the vscode storage location is inconsistent with the code storage location,Personally recommend the first method

Method 1: Configure in 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

How to import python library in vscode? Three ways to share

, which is the address of the c drive here (the address of the d drive later is where I run Don’t worry about the saving address of the code.

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

2, Open the folder at the corresponding address on your 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 the folder address: C:\Users\Rover\AppData \Local\Programs\Python\Python38-32\Scripts

How to import python library in vscode? Three ways to share
How to import python library in vscode? Three ways to share

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

How to import python library in vscode? Three ways to share

4. Take installing python-pptx as an example, enter -pip install python-pptx (Just replace it with any library name

How to import python library in vscode? Three ways to share

5. After the automatic download is successful, the following prompt will appear

How to import python library in vscode? Three ways to share
End here

Extension: He reminded me to upgrade pip and enter the command python -m pip install --upgrade pipor python.exe -m pip install -- upgrade pip can

How to import python library in vscode? Three ways to share
Enter the command:
How to import python library in vscode? Three ways to share
Success!

Method 2: Import directly in vscode

Enter pip install option in the console (write the name of the imported library, such as import option here)

How to import python library in vscode? Three ways to share

Method 3: Use anaconda to import

Refer to this article to install the python library through anaconda

https://blog.csdn.net/Rover95/article/details/113464575?spm=1001.2014.3001.5501

For more knowledge about VSCode, please visit: vscode tutorial! !

The above is the detailed content of How to import python library in vscode? Three ways to share. 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