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

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.

主站蜘蛛池模板: 合水县| 晋州市| 高淳县| 蒲江县| 边坝县| 西盟| 东乌珠穆沁旗| 毕节市| 安阳市| 古田县| 铜鼓县| 宁晋县| 隆德县| 永胜县| 揭西县| 始兴县| 肃宁县| 红河县| 金坛市| 沧源| 建宁县| 泸水县| 六安市| 禹城市| 合阳县| 瑞金市| 堆龙德庆县| 永安市| 黔西县| 安新县| 响水县| 东明县| 临颍县| 西峡县| 策勒县| 阿尔山市| 会理县| 同德县| 阳朔县| 曲靖市| 牟定县|