CentOS7 yum 安装 pip3 和 python3
关键词:python2 python3 pip2 pip3 依赖安装 YUM安装PIP CentOS7CentOS7 yum 安装 pip3 和 python3步骤yum install python3#上面的命令会自动安装python3、pip3更新pip3python3 -m pip install --upgrade pip setuptools wheel -i https://mirro
·
关键词:python3 pip3 依赖安装 YUM安装PIP CentOS7
CentOS7 yum 安装 pip3 和 python3
步骤
yum install python3
#上面的命令会自动安装python3、pip3
更新pip3
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple/
# python3 -m pip --version
pip 20.2.4 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
冗余信息
Installed:
python3.x86_64 0:3.6.8-13.el7
Dependency Installed:
libtirpc.x86_64 0:0.2.4-0.16.el7 python3-libs.x86_64 0:3.6.8-13.el7 python3-pip.noarch 0:9.0.3-7.el7_7
python3-setuptools.noarch 0:39.2.0-10.el7
# which python3 ==> /usr/bin/python3
# which pip3 ==> /usr/bin/pip3
# python3 --version ==> Python 3.6.8
# pip3 --version ==> pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)
pip3 基本使用
python3 -m pip list
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple requests
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple paramiko
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple flask
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple python-dotenv
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple pipenv
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple flask
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple PyMySQL
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple kafka-python
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple fastapi
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple uvicorn
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple docker
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
更换为国内下载源
国内源
阿里云 https://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) https://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
一般都用https,http可能报错
命令行直接添加
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple requests
如果提示不信任,则
python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com requests
python2 同理
修改配置文件
cat ~/.pip/pip.conf #没有这个文件则创建之
[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com
requirements.txt
pip的freeze命令用于生成将当前项目的pip类库列表生成 requirements.txt 文件:
pip freeze > requirements.txt
安装requirements.txt中的类库内容
pip install -r requirements.txt
参考资料
https://packaging.python.org/tutorials/installing-packages/#install-pip-setuptools-and-wheel
https://packaging.python.org/guides/installing-using-linux-tools/
https://packaging.python.org/tutorials/installing-packages/
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
已为社区贡献3条内容
所有评论(0)