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


  • 相关阅读:
    问题:sqlserver 跨服务器连接;结果:Sql Server 跨服务器连接
    SpringBoot之Servlet、Filter、Listener配置
    spring boot 使用@ConfigurationProperties
    Mysql字段属性应该尽量设置为not null
    微服务—ELK分布式日志框架
    微服务—分布式服务追踪sleuth和zipkin
    微服务—熔断器Hystrix
    @RequestBody和@ResponseBody的使用情形以及RestTemplate的http报文转换
    application/x-www-form-urlencoded和multipart/form-data
    基于JWT的token身份认证方案
  • 原文地址:https://www.cnblogs.com/cloud-datacenter/p/13200246.html
Copyright © 2011-2022 走看看