com.unity.ml-agents/Documentation~/Using-Virtual-Environment.md
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. To learn more about Virtual Environments see here.
A Virtual Environment keeps all dependencies for the Python project separate from dependencies of other projects. This has a few advantages:
This guide has been tested with Python 3.10.12. Newer versions might not have support for the dependent libraries, so are not recommended.
While there are many options for setting up virtual environments for python, by far the most common and simpler approach is by using Anaconda (aka Conda). You can read the documentation on how to get started with Conda here.
get-pip.py file using the command curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython3 get-pip.pypip3 -VNote (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
$ mkdir ~/python-envssample-env execute $ python3 -m venv ~/python-envs/sample-env$ source ~/python-envs/sample-env/bin/activate$ pip3 install --upgrade pip$ pip3 install --upgrade setuptools$ deactivate (you can reactivate the environment using the same activate command listed above)$ sudo apt-get install python3-venvmd python-envssample-env execute python -m venv python-envs\sample-envpython-envs\sample-env\Scripts\activatepip install --upgrade pipdeactivate (you can reactivate the environment using the same activate command listed above)Note:
cmd and execute python --version to verify the version.