Centos离线安装ansible

Centos离线安装ansible

1、首先是互联网环境,安装python,创建虚拟环境,更新pip和setuptools

python3 -m venv venv_2 # 此处 venv_2 也是自定义的虚拟环境名字

退出虚拟环境deactivate

进入虚拟环境source ~/ansible/bin/activate

pip install --upgrade pip

2、在线安装ansible

pip install ansible

或者pip install ansible==版本号 pip install ansible==2.9.10

3、导出ansible需要的文件

pip freeze>requirements.txt

4、下载上述文件对应的包

pip download -r requirements.txt -d ./pip_packages 或者

pip download -d PIPDIR -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

d指定导出的文件夹

复制代码
 -r指定根据哪一个文件导出

 -i表示使用阿里源(当然可以使用其他国内源啊)
 --trusted-host表示信任主机
5、把包放入离线环境,然后执行如下命令安装ansible的包

pip install --no-index --find-links=./ -r requirements.txt

相关推荐
fish_study_csdn5 小时前
pytest 技术总结
开发语言·python·pytest
咖啡调调。5 小时前
使用Django框架表单
后端·python·django
BO_S__5 小时前
python调用ffmpeg对截取视频片段,可批量处理
python·ffmpeg·音视频
就叫飞六吧5 小时前
如何判断你的PyTorch是GPU版还是CPU版?
人工智能·pytorch·python
pyengine7 小时前
基于pandoc的MarkDown格式与word相互转换小工具开发(pyqt5)
开发语言·python·qt·word
YuSun_WK7 小时前
配置MambaIRv2: Attentive State Space Restoration的环境
开发语言·python
Nick_zcy7 小时前
开发基于python的商品推荐系统,前端框架和后端框架的选择比较
开发语言·python·前端框架·flask·fastapi
一点.点8 小时前
李沐动手深度学习(pycharm中运行笔记)——04.数据操作
pytorch·笔记·python·深度学习·pycharm·动手深度学习
Niuguangshuo8 小时前
Python 设计模式:访问者模式
python·设计模式·访问者模式
Jamesvalley8 小时前
【Django】新增字段后兼容旧接口 This field is required
后端·python·django