浏览代码

added venv setup documentation for windows

/develop-gpu-test
Anupam Bhatnagar 5 年前
当前提交
02f9ad67
共有 1 个文件被更改,包括 28 次插入9 次删除
  1. 37
      docs/Using-Virtual-Environment.md

37
docs/Using-Virtual-Environment.md


# Using Virtual Environment
## What is a Virtual Environment?
A Virtual Environment is a walled garden for Python projects.
A Virtual Environment is a self contained directory tree that contains a Python installation
for a particular version of Python, plus a number of additional packages.
1. Firstly, it makes dependency management for the project easy.
1. Secondly, it enables using and testing of different library versions by quickly
1. It makes dependency management for the project easy.
1. It enables using and testing of different library versions by quickly
spinning up a new environment and verifying the compatibility of the code with the
different version.

## Installing Pip (Required)
1. Download the `get-pip.py` file using the command `curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py`
1. Run the following `python3 get-pip.py`
1. Check pip version using `pip3 -V`
Note (for Ubuntu users): If the `ModuleNotFoundError: No module named 'distutils.util'` error is encountered, then
python3-distutils needs to be installed. Install python3-distutils using `sudo apt-get install python3-distutils`
1. Create a folder where the virtual environments will live ` $ mkdir ~/python-venvs `
1. To create a new environment named `test-env` execute `$ python3 -m venv ~/python-envs/test-env`
1. To activate the environment execute `$ source ~/python-envs/test-env/bin/activate`
1. Create a folder where the virtual environments will reside `$ mkdir ~/python-venvs`
1. To create a new environment named `sample-env` execute `$ python3 -m venv ~/python-envs/sample-env`
1. To activate the environment execute `$ source ~/python-envs/sample-env/bin/activate`
1. Verify pip version is the same as in the __Installing Pip__ section. In case it is not the latest, upgrade to
the latest pip version using `pip3 install --upgrade pip`
1. To deactivate the environment execute `$ deactivate `
1. To deactivate the environment execute `$ deactivate`
1. Follow steps 2-5 in the Mac OS X installation.
1. Follow the steps in the Mac OS X installation.
Coming Soon.
1. Create a folder where the virtual environments will reside `$ md python-venvs`
1. To create a new environment named `sample-env` execute `$ python3 -m venv python-envs\sample-env`
1. To activate the environment execute `$ python-envs\sample-env\Scripts\activate`
1. Verify pip version is the same as in the __Installing Pip__ section. In case it is not the latest, upgrade to
the latest pip version using `pip3 install --upgrade pip`
1. Install ML-Agents package using `$ pip3 install mlagents`
1. To deactivate the environment execute `$ deactivate`
正在加载...
取消
保存