官术网_书友最值得收藏!

Setting up a virtual environment

A virtual environment is the way Python isolates full package environments from one another. This means you can easily manage dependencies. Imagine you want to define the minimum necessary packages for a project; a virtual environment would be perfect to let you test and export the list of needed packages. We will discuss it later on. Now, create a new terminal pressing Ctrl + Shift + T on your keyboard and create our hello world environment like this:

mkvirtualenv hello
pip install flask

The first line creates our environment with the name "hello". You will also automatically load that environment into the current terminal. You can deactivate your virtual environment by typing deactivate and you can load it again with the following command:

workon hello # substitute hello with the desired environment name if needed

The second line tells pip to install the Flask package in the current virtual environment, hello in this case.

主站蜘蛛池模板: 启东市| 渭南市| 三穗县| 颍上县| 凌云县| 宣威市| 抚州市| 海兴县| 杂多县| 镇平县| 双鸭山市| 乳源| 汨罗市| 宜兰县| 荆州市| 调兵山市| 奉贤区| 长寿区| 大兴区| 柳州市| 贡山| 珠海市| 朝阳县| 蒙阴县| 拉萨市| 宝坻区| 抚顺市| 宜黄县| 思茅市| 临漳县| 龙海市| 阳信县| 石城县| 乐陵市| 建平县| 阳高县| 榆林市| 东乡县| 萝北县| 天津市| 远安县|