---
# System prepended metadata

title: pip module 07
tags: [Ansible module]

---

# pip module 07

### 創立虛擬環境, 並在內部安裝pip

```yaml=
- pip:
    name: flask
    state: present

# 選擇特定版本
- name: Install bottle python package on version 0.11
  pip:
    name: bottle==0.12.19

# 設定版本範圍
- name: Install bottle python package with version specifiers
  pip:
    name: bottle>0.12.15,<0.12.18,!=0.12.17

在虛擬環境中安裝python 套件
- name: pip install flask
  pip:
    name: flask
    state: present
    virtualenv: /home/vagrant/vir
    virtualenv_command: python3 -m venv
```

###### tags: `Ansible module`