Install pip3 package using ansible instead of pip2
Try to use executable
option. Excerpt from pip
module doc:
executable
(added in 1.3)The explicit executable or a pathname to the executable to be used to run pip for a specific version of Python installed in the system. For example pip-3.3, if there are both Python 2.7 and 3.3 installations in the system and you want to run pip for the Python 3.3 installation. It cannot be specified together with the 'virtualenv' parameter (added in 2.1). By default, it will take the appropriate version for the python interpreter use by ansible, e.g. pip3 on python 3, and pip2 or pip on python 2.
Update:
To combine virtualenv
path and alternative executable, use virtualenv_command
like this:
- pip: virtualenv: /tmp/py3 virtualenv_command: /usr/bin/python3 -m venv name: boto
Absolute path is required for virtualenv_command
.