Python学习之十三_pip的学习
pip的含义
pip:
pip is the package installer for Python.
You can use pip to install packages from
the Python Package Index and other indexes.
pip 其实就是python的包管理器:
Packages Install for Python
他可以在线安装也可以离线安装whl文件.
whl文件的含义是 wheel轮子的含义.
python的重要思想就是使用已有的包,内置battery,
不需要大家重复造轮子.
pip的简单使用-1
设置包源地址 - 国内必备技能
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple
pip config set install.trusted-host mirrors.aliyun.com
其实可以看到. 他修改的文件. 下次直接修改文件就可以.
阿里云 https://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣 https://pypi.douban.com/simple
Python官方 https://pypi.python.org/simple/
v2ex https://pypi.v2ex.com/simple/
中国科学院 https://pypi.mirrors.opencas.cn/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学 [https://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学:https://pypi.hustunique.com/
山东理工大学:https://pypi.sdutlinux.org/
如果不想修改默认值可以使用
pip install something -i 国内源 也可以.
pip的简单使用-2
经常会提示pip的版本太低,可以还是用如下方式进行升级:
python -m pip install --upgrade pip
在能够上网的情况下能够将pip升级到最新.
在施工pycharm时可以使用界面化的包管理器进行安装包.
需要注意会在site-packages 里面添加上很多必要的软件.
类似我这系统就会在如下目录创建:
C:\python311\Lib\site-packages
需要注意,如果是想绿色版本继续编译的话, 这个目录下的文件必不可少.
pip的简单使用-2
install 【 安装包安装 (Install packages.)】
download 【 下载下载包 (Download packages.)】
uninstall 【 卸载卸载包 (Uninstall packages.)】
freeze 【 冻结按需求格式安装的包的输出 (Output installed packages in requirements format.)】
list 【 列表列出已安装的包 ( List installed packages.)】
show 【 显示已安装软件包的信息 ( Show information about installed packages.)】
check 【 检查已安装的软件包是否具有兼容的依赖项 ( Verify installed packages have compatible dependencies.)】
config 【 配置管理本地和全局配置 ( Manage local and global configuration.)】
search 【 搜索PyPI查找包 (Search PyPI for packages.)】
wheel 【 根据您的需求构建轮子 (Build wheels from your requirements.)】
hash 【 包存档的哈希计算值 ( Compute hashes of package archives.)】
completion 【 用于命令完成的辅助命令 ( A helper command used for command completion.)】
debug 【 显示对调试有用的信息 ( Show information useful for debugging.)】
help 【 帮助显示命令的帮助 (Show help for commands.)】
pip安装的一个案例