问题描述
我们项目众多,我们需要在 PyCharm 中针对不同项目使用 virtualenv 特性,来隔离各个项目的运行环境。
该笔记将记录:在 virtualenv 功能。
解决方案
1)进入项目设置页面:File / Settings... / Project: <project-name> / Project Interpreter
2)添加新的解释程序:
Base interpreter:,指定用于创建虚拟环境的 Python 版本,将基于该版本创建虚拟环境;
Inherit global site-packages,用于继承已经安装在系统中的模块;
Make available to all projects,对于所有项目都可以见该虚拟环境;
Make available to all projects,对于所有项目都可以见该虚拟环境;
相关内容
基于项目的 requirements.txt / setup.py 创建特定的虚拟环境:
Create a virtual environment using the project requirements
参考文献
WikiNotes/配置使用虚拟环境(virtualenv)
Configure a virtual environment—PyCharm