zoukankan      html  css  js  c++  java
  • python fabric安装

    1 安装epel
    wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
    2 安装pip
    yum install python-pip -y
    pip install --upgrade pip
    3 安装virtualenv虚拟环境(源可以使用阿里云或者douban的,国外太慢了。)
    pip install -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com virtualenv
    4 virtualenv使用
    创建虚拟化环境:virtualenv venv
    激活虚拟化环境:source venv/bin/activate
    退出虚拟化环境: deactivate
    [root@localhost ~]# virtualenv venv
    created virtual environment CPython2.7.5.final.0-64 in 3125ms
    creator CPython2Posix(dest=/root/venv, clear=False, global=False)
    seeder FromAppData(download=False, pip=bundle, wheel=bundle, setuptools=bundle, via=copy, app_data_dir=/root/.local/share/virtualenv)
    added seed packages: pip==20.1.1, setuptools==44.1.1, wheel==0.34.2
    activators PythonActivator,CShellActivator,FishActivator,PowerShellActivator,BashActivator
    [root@localhost ~]# source venv/bin/activate
    (venv) [root@localhost ~]# deactivate
    5 安装fabric
    pip install -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com fabric
    检查包情况
    (venv) [root@localhost ~]# pip freeze
    DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
    bcrypt==3.1.7
    cffi==1.14.0
    cryptography==2.9.2
    enum34==1.1.10
    fabric==2.5.0
    invoke==1.4.1
    ipaddress==1.0.23
    paramiko==2.7.1
    pycparser==2.20
    PyNaCl==1.4.0
    six==1.15.0
    6 查看 python fabric的对象
    (venv) [root@localhost ~]# python
    Python 2.7.5 (default, Apr 11 2018, 07:36:10)
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import fabric
    >>> dir(fabric)
    ['Config', 'Connection', 'Executor', 'Group', 'GroupResult', 'Remote', 'Result', 'SerialGroup', 'Task', 'ThreadingGroup', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', '__version__', '__version_info__', '_version', 'config', 'connection', 'exceptions', 'executor', 'group', 'runners', 'task', 'tasks', 'transfer', 'tunnels', 'util']
    >>>
    查看fabric的版本
    (venv) [root@localhost ~]# fab --version
    Fabric 2.5.0
    Paramiko 2.7.1
    Invoke 1.4.1


  • 相关阅读:
    【强转】QEMU+GDB调试linux内核全过程
    从上往下打印二叉树
    栈的压入、弹出序列
    包含main函数的栈
    顺时针打印矩阵
    Linux终端美化
    Linux 终端美化
    KDE桌面环境自带的Konsole终端配置
    KDE美化及常用设置
    KDE常用桌面插件总结
  • 原文地址:https://www.cnblogs.com/cloud-datacenter/p/13200246.html
Copyright © 2011-2022 走看看