创建虚拟环境

使用pipenv虚拟环境

使用现有的虚拟环境配置

需要先在终端创建好虚拟环境pipenv创建虚拟环境
第一步:先找到虚拟环境路径
#进入虚拟环境
pipenv shell
#查看虚拟环境安装目录
pipenv —venv
# 输出虚拟环境路径:
/Users/userName/.local/share/virtualenvs/demo-new-nunSnMWd
第二步:pycharm修改python解析器
进入pycharm 依次点击Pycharm—>Preferences…
找到Project:xxx(你的项目名称),依次点击图中1、2、3所示位置
在跳出的页面依次选择 Virtualenv Environment->Existing environment
image.png
在跳出的页面依次选择 Virtualenv Environment->Existing environment在Interpreter选择虚拟环境的解析器image.png

pycharm中直接创建

base interpreter:表示你用的python路径
pipenv executable:表示你的pipenv路径
image.png