如何在Windows上执行python的Ansible模块?

时间:2019-04-24 07:58:38

标签: python-3.x windows ansible

我通过python 3.7在Windows Server 2012上安装了Ansible (按照这篇文章的说明:https://stackoverflow.com/a/52614973/7098543)。

但是,我收到错误消息:没有名为ansible的模块。主要。我该怎么解决?

我知道Ansible不支持在Windows上安装控制机。但是,我必须使用Windows Server 2012。

通过python 3.7安装Ansible(版本:2.7.10)后,我尝试运行:

python -m ansible --version

我得到了错误: 没有名为ansible的模块。主要; “ ansible”是一个程序包,不能直接执行。

有任何解决方法吗?请帮忙。

1 个答案:

答案 0 :(得分:1)

实际上,我不知道要解决此问题的想法或解决方法。但是,我找到了其他与Cygwin一起安装Ansible的解决方案。

    1. Open up a Cygwin Terminal
    2. alias cyg-get="/path/to/cygwin/setup/package/setup-x86_64.exe -q -P"
    3. cyg-get cygwin32-gcc-g++,gcc-core,gcc-g++,git,libffi-devel,nano,openssl,openssl-devel,python-crypto,python3,python3-devel,python3-openssl,python3-pip,python3-setuptools,python3-devel,tree,wget,zip,make,curl,git python-jinja2,python-six,python-yaml, cryptography
    4. curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
    5. python3 get-pip.py
    6. pip --version
    7. git clone --depth 1 git://github.com/ansible/ansible
    8. cd ansible
    9. python3 setup.py install

希望这篇文章对某人有所帮助! 刷新链接:

  1. Cygwin - How to install ansible?
  2. How to overcome - pip install ansible on windows failing with filename or extension too long on windows