## 环境搭建
![](https://img.kancloud.cn/47/43/4743e916675a63fcf6fe9f0b23a25f3f_809x521.jpg)
### 1.python和pip检查是否安装成功
```
wangyijiadeMacBook-Air:~ bizzbee$ python -V
Python 3.7.0
wangyijiadeMacBook-Air:~ bizzbee$ pip -V
pip 19.2.1 from /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip (python 3.7)
```
### 安装pipenv
>创建项目文件夹,在文件夹里面运行安装命令。
```
wangyijiadeMacBook-Air:fisher bizzbee$ sudo pip3 install pipenv -i https://pypi.douban.com/simple/
```
> 然后为当前项目pipenv安装虚拟环境
> 在项目文件夹执行命令
```
pipenv install
```
> 激活或进入虚拟环境
```
wangyijiadeMacBook-Air:fisher bizzbee$ pipenv shell
Launching subshell in virtual environment…
bash-3.2$ . /Users/bizzbee/.local/share/virtualenvs/fisher-nuEPyaha/bin/activate
(fisher) bash-3.2$
```
> 这样就进入了虚拟环境,这个环境是只属于当前项目的。
#### 常用命令
```
(fisher) bash-3.2$ exit 退出虚拟环境命令
exit
wangyijiadeMacBook-Air:fisher bizzbee$ pipenv shell 进入虚拟环境命令
Launching subshell in virtual environment…
bash-3.2$ . /Users/bizzbee/.local/share/virtualenvs/fisher-nuEPyaha/bin/activate
(fisher) bash-3.2$ pipenv graph 查看包依赖关系
Flask==1.1.1
- click [required: >=5.1, installed: 7.0]
- itsdangerous [required: >=0.24, installed: 1.1.0]
- Jinja2 [required: >=2.10.1, installed: 2.10.1]
- MarkupSafe [required: >=0.23, installed: 1.1.1]
- Werkzeug [required: >=0.15, installed: 0.15.5]
(fisher) bash-3.2$
```
### 安装flask
![](https://img.kancloud.cn/33/71/3371e77658eefdd3e444de4d438aa7cd_393x158.png)