# how could I use python 3 for ansible command

**URL:** <https://forum.ansible.com/t/how-could-i-use-python-3-for-ansible-command/29809>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [March 2, 2019, 1:36am UTC](https://forum.ansible.com/t/how-could-i-use-python-3-for-ansible-command/29809 "2019-03-02T01:36:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason\_Yu](https://avatars.discourse-cdn.com/v4/letter/j/e274bd/32.png) [@Jason\_Yu](https://forum.ansible.com/u/Jason_Yu)\
**Post date:** [March 2, 2019, 1:36am UTC](https://forum.ansible.com/t/how-could-i-use-python-3-for-ansible-command/29809/1 "2019-03-02T01:36:45Z")

</div>

I have two versions of python installed. If I don’t run the scl command, I will use python 2.7, but when I use scl command, it swith to use python 3. What is the difference between these two methods?

When I try to see which verion of python ansible uses, it says version 2.7. how could I make anislbe use version 3.

[root@g0dvlnxjyu01 ~]# python -V  
Python 2.7.5

[root@g0dvlnxjyu01 ~]# scl enable rh-python36 bash  
[root@g0dvlnxjyu01 ~]# python -V  
Python 3.6.3  
[root@g0dvlnxjyu01 ~]# ansible --version | grep “python version”  
python version = 2.7.5 (default, Sep 12 2018, 05:31:16) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]  
[root@g0dvlnxjyu01 ~]# which version  
/usr/bin/which: no version in (/opt/rh/rh-python36/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/opt/omi/bin:/root/.local/bin:/root/Repo/DevOps/AWS/terra-test:/root)  
[root@g0dvlnxjyu01 ~]# which python  
/opt/rh/rh-python36/root/usr/bin/python  
[root@g0dvlnxjyu01 ~]#
