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

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.

主站蜘蛛池模板: 张掖市| 调兵山市| 吉林省| 河南省| 宝兴县| 天全县| 界首市| 监利县| 洛阳市| 景德镇市| 邵东县| 定陶县| 丰镇市| 迁安市| 和田市| 崇义县| 宁晋县| 青川县| 于都县| 太白县| 茶陵县| 迁安市| 灵宝市| 饶阳县| 郁南县| 微博| 应城市| 工布江达县| 南澳县| 隆尧县| 沾益县| 明星| 商都县| 宝山区| 赤峰市| 兖州市| 江门市| 临湘市| 获嘉县| 巧家县| 增城市|