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

Setting up the environment

It's always a good practice to work on projects in separate environments. An environment is a space that keeps the libraries and dependencies, which are installed inside it, isolated from the global space of the operating system. Suppose you have to work on two projects; one requires an older version of a library and the other uses a newer version. In this situation, installing the newer version globally would overwrite the older version and make the first project unusable. However, you can create two separate environments for the two projects and install the required versions separately. Hopefully, you now get the idea behind working in environments.

We will use Miniconda, which is a small part of open source Python package management and distribution Anaconda. Conda is the package manager in Miniconda that aids in installing and managing packages with Python.

We will follow this step-by-step procedure to set up our working environment with Conda:

  1. Download Miniconda for Python 3.7 according to your operating system from https://conda.io/en/latest/miniconda.html. Install Miniconda by simply running the downloaded file.
  1. You may want to create a separate directory for storing the codes that we will be covering in this book. Let's call it the deep_learning directory. Pull up a Terminal and change to the following directory, in case you wish to upgrade to the latest version of Conda and upgrade packages:
conda upgrade conda
conda upgrade --all
  1. Now we will use Conda to create our working environment. Issue the following command into your Terminal window. Name the environment what you want; we name it test_env here:
conda create -n test_env
  1. To activate the environment, issue the following command:
conda activate test_env
  1. To deactivate the environment when you are done, issue the following command in the Terminal window:
  conda deactivate
Inside the environment created with Conda , you can use both pip (default package manager for Python) and Conda (package manager for Anaconda) to install libraries.

To view the packages that are installed in your environment, you can use the following command:

conda list

It will show the packages, irrespective of whether they are installed with conda or pip.

主站蜘蛛池模板: 牙克石市| 休宁县| 新巴尔虎右旗| 孟连| 仙桃市| 鸡东县| 永兴县| 巫溪县| 赤壁市| 潮州市| 广宁县| 洛南县| 泸水县| 密云县| 手游| 临汾市| 胶南市| 木兰县| 准格尔旗| 乌鲁木齐县| 阜宁县| 宁武县| 通州区| 惠来县| 普陀区| 安宁市| 无锡市| 日喀则市| 石狮市| 吐鲁番市| 汉川市| 佛学| 马尔康县| 泰兴市| 大悟县| 嘉鱼县| 奎屯市| 韶关市| 石门县| 巴林左旗| 长沙县|