命令行输入pip install 加要安装的模块之后回车 例如:
pip install lxml
d:\python\python\python.exe -m pip install --upgrade pip
之后回车,就可成功升级pip版本.基本用不到,只有极少条件下用到,升级指定的包,通过使用==, >=, <=, >, < 来指定一个版本号。例如:
pip install somepackage==1.2.3
回车,
C:\Users\巭孬的石头哥>pip install somepackage==1.2.3
Collecting somepackage==1.2.3
Using cached somepackage-1.2.3.tar.gz (8.6 kB)
Using legacy 'setup.py install' for somepackage, since package 'wheel' is not installed.
Installing collected packages: somepackage
Running setup.py install for somepackage ... done
Successfully installed somepackage-1.2.3
安装成功
命令行输入pip uninstall 加 库名 例如:
pip uninstall SomePackage==1.2.3
回车
Found existing installation: somepackage 1.2.3
Uninstalling somepackage-1.2.3:
Would remove:
d:\python\python\lib\site-packages\somepackage-1.2.3-py3.8.egg-info
d:\python\python\lib\site-packages\somepackage\*
Proceed (y/n)?
此时输入 y
回车得到:
Successfully uninstalled somepackage-1.2.3
卸载成功.
命令行输入pip list
回车,可以列出已安装的库和对应的版本 例如:
C:\Users\巭孬的石头哥>pip list
Package Version
----------- ---------
certifi 2020.6.20
chardet 3.0.4
idna 2.10
lxml 4.6.1
pip 20.2.4
requests 2.24.0
setuptools 49.2.1
somepackage 1.2.3
urllib3 1.25.11
命令行输入:pip show
加安装包名称,例如:
C:\Users\巭孬的石头哥>pip show pip
Name: pip
Version: 20.2.4
Summary: The PyPA recommended tool for installing Python packages.
Home-page: https://pip.pypa.io/
Author: The pip developers
Author-email: distutils-sig@python.org
License: MIT
Location: d:\python\python\lib\site-packages
Requires:
Required-by:
命令行输入:pip freeze
加保存的地点,例如:
pip freeze >C:\Users\巭孬的石头哥\Desktop\install.txt
C:\Users\巭孬的石头哥>pip install wheel
Collecting wheel
Downloading wheel-0.35.1-py2.py3-none-any.whl (33 kB)
Installing collected packages: wheel
Successfully installed wheel-0.35.1
C:\Users\巭孬的石头哥\Desktop>pip install pygame-1.9.6-cp38-cp38-win_amd64.whl
豆瓣 :http://pypi.douban.com/simple/
阿里 :http://mirrors.aliyun.com/pypi/simple/
中国科学技术大学:http://pypi.mirrors.ustc.edu.cn/simple
清华:https://pypi.tuna.tsinghua.edu.cn/simple
例如:pip install SomePackage -i
https://pypi.douban.com/simple
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : ${DATE} ${TIME}
# @Author : Jerry
# @File : ${NAME}.py
# @Software: ${PRODUCT_NAME}