correct the Python 3 Pip environment setup instructions (#30988)

pull/31033/head
Luke Short 7 years ago committed by Jordan Borean
parent 0b0348d81c
commit c6a676c025

@ -21,19 +21,26 @@ Testing Python 3 with commands and playbooks
.. code-block:: shell .. code-block:: shell
python3 /usr/bin/ansible localhost -m ping $ python3 /usr/bin/ansible localhost -m ping
python3 /usr/bin/ansible-playbook sample-playbook.yml $ python3 /usr/bin/ansible-playbook sample-playbook.yml
You can also install Ansible using :program:`pip` for Python3 which will make the default You can also install Ansible using :program:`pip` for Python3 which will make the default
:command:`/usr/bin/ansible` run with Python3: :command:`/usr/bin/ansible` run with Python3:
.. code-block:: shell .. code-block:: shell
$ virtualenv py3-ansible $ virtualenv --python=python3 py3-ansible
$ source ./bin/activate $ source ./py3-ansible/bin/activate
$ pip3 install ansible $ pip3 install ansible
$ ansible --version|grep python $ ansible --version | grep "python version"
python version = 3.5.3 (default, May 10 2017, 15:05:55) [GCC 6.3.1 20161221 (Red Hat 6.3.1-1)] python version = 3.6.2 (default, Sep 22 2017, 08:28:09) [GCC 7.2.1 20170915 (Red Hat 7.2.1-2)]
On systems with SELinux installed, such as Red Hat Enterprise Linux or Fedora, the SELinux Python libraries also need to be copied over.
.. code-block:: shell
$ cp -r -v /usr/lib64/python3.*/site-packages/selinux/ ./py3-ansible/lib64/python3.*/site-packages/
$ cp -v /usr/lib64/python3.*/site-packages/*selinux*.so ./py3-ansible/lib64/python3.*/site-packages/
.. note:: Individual Linux distribution packages may be packaged for Python2 or Python3. When running from .. note:: Individual Linux distribution packages may be packaged for Python2 or Python3. When running from
distro packages you'll only be able to use Ansible with the Python version for which it was distro packages you'll only be able to use Ansible with the Python version for which it was
@ -64,8 +71,8 @@ Testing Python 3 module support
.. code-block:: shell .. code-block:: shell
ansible localhost-py3 -m ping $ ansible localhost-py3 -m ping
ansible-playbook sample-playbook.yml $ ansible-playbook sample-playbook.yml
Note that you can also use the :option:`-e` command line option to manually Note that you can also use the :option:`-e` command line option to manually
@ -73,8 +80,8 @@ set the python interpreter when you run a command. For example:
.. code-block:: shell .. code-block:: shell
ansible localhost -m ping -e 'ansible_python_interpreter=/usr/bin/python3' $ ansible localhost -m ping -e 'ansible_python_interpreter=/usr/bin/python3'
ansible-playbook sample-playbook.yml -e 'ansible_python_interpreter=/usr/bin/python3' $ ansible-playbook sample-playbook.yml -e 'ansible_python_interpreter=/usr/bin/python3'
What to do if an incompatibility is found What to do if an incompatibility is found
----------------------------------------- -----------------------------------------

Loading…
Cancel
Save