How to install modules in python (two methods, just copy and use)

Here is a brief introduction to the two methods of installing modules in python.

The first

Install the module in pycharm
insert image description here
insert image description here
I am here because it has already been installed, so this will appear.

# 安装模块
# pip install 模块名
# 可以指定安装版本 如安装requests 版本是2.25.1
# pip install requests==2.25.1

# 如果觉安装的太慢,可以用下面的方法

# 三个镜像源网址
# 阿里云镜像源 http://mirrors.aliyun.com/pypi/simple/
# 清华镜像源 https://mirrors.tuna.tsinghua.edu.cn/help/pypi/
# 豆瓣镜像源 https://pypi.doubanio.com/simple  

# 要有空格隔开!!!
# pip install -i 镜像源网址 模块名
# 同样也可以指定版本
# pip install -i https://mirrors.tuna.tsinghua.edu.cn/help/pypi/ requests==2.25.1

# 查看可以升级的包
# pip list --outdate

# 升级包
# pip install --upgrade 包名

# 卸载模块
# pip uninstall 模块名



# 我们也可以查看自己安装了多少模块
# pip list

insert image description here

the second

Win+R pops up the shortcut key to run the command, enter cmd, then press Enter, and enter in the pop-up window

# 第一种方法都能在这里使用
# pip install 模块名

# 阿里云镜像源 http://mirrors.aliyun.com/pypi/simple/
# 清华镜像源 https://mirrors.tuna.tsinghua.edu.cn/help/pypi/
# 豆瓣镜像源 https://pypi.doubanio.com/simple
# pip install -i 镜像源网址 模块名

# 卸载模块
# pip uninstall 模块名

# 我们也可以查看自己安装了多少模块
# pip list

insert image description here

Summarize

This article introduces the method of python installation module, one is to install in the terminal of pycharm, and the other is to install the module in the command prompt interface. The effect of the two is the same. It depends on which method you prefer. If the article is wrong, please correct me, thank you!

Guess you like

Origin blog.csdn.net/qq_65898266/article/details/124809210