Adding a quick howto on setting up virtualenvs
Change-Id: I0f49a3e8cd47a9b8303261ccffa0c3e9f260a1fc
This commit is contained in:
@@ -6,4 +6,6 @@ Getting Started
|
|||||||
|
|
||||||
setting_up_env
|
setting_up_env
|
||||||
install
|
install
|
||||||
using
|
using
|
||||||
|
pyenv/index
|
||||||
|
virtualenv/index
|
||||||
|
|||||||
40
docs/source/getting_started/pyenv/index.rst
Normal file
40
docs/source/getting_started/pyenv/index.rst
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
==========================
|
||||||
|
Working with pyenv
|
||||||
|
==========================
|
||||||
|
|
||||||
|
.. _installing_pyenv:
|
||||||
|
|
||||||
|
Installing pyenv
|
||||||
|
=================
|
||||||
|
|
||||||
|
The official installation guide is available here `pyenv on github <https://github.com/yyuu/pyenv#installation>`_. The official guide includes instructions for Mac OS X as well.
|
||||||
|
|
||||||
|
Installing pyenv on Ubuntu:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
sudo apt-get install git python-pip make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev
|
||||||
|
sudo pip install virtualenvwrapper
|
||||||
|
|
||||||
|
git clone https://github.com/yyuu/pyenv.git ~/.pyenv
|
||||||
|
git clone https://github.com/yyuu/pyenv-virtualenvwrapper.git ~/.pyenv/plugins/pyenv-virtualenvwrapper
|
||||||
|
|
||||||
|
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
|
||||||
|
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
|
||||||
|
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
|
||||||
|
echo 'pyenv virtualenvwrapper' >> ~/.bashrc
|
||||||
|
|
||||||
|
exec $SHELL
|
||||||
|
|
||||||
|
Installing a fresh version of Python
|
||||||
|
=====================================
|
||||||
|
|
||||||
|
Now that pyenv and the virtualenvwrapper plugin is installed. We need to download and install a version of python. In this case, we're going to install Python 2.7.6.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
# Install
|
||||||
|
pyenv install 2.7.6
|
||||||
|
|
||||||
|
# Set 2.7.6 as your shell default
|
||||||
|
pyenv global 2.7.6
|
||||||
@@ -1,3 +1,39 @@
|
|||||||
====================
|
=====================================
|
||||||
Setup Environment
|
Setting up a Development Environment
|
||||||
====================
|
=====================================
|
||||||
|
|
||||||
|
OpenCAFE strongly recommends the use of Python virtual environments for development.
|
||||||
|
|
||||||
|
While not required, if you wish to manage your Python versions as well as virtual environments, we suggest the use of pyenv. Instructions on installing pyenv can be found here: :ref:`installing_pyenv`
|
||||||
|
|
||||||
|
|
||||||
|
Building your virtual environment
|
||||||
|
==================================
|
||||||
|
If you wish to run OpenCAFE in a virtual environment, then you will need to `install virtualenv <http://www.virtualenv.org/en/latest/virtualenv.html#installation>`_
|
||||||
|
|
||||||
|
For easier management of your virtual environments, it is recommended that you install virtualenvwrapper as well.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
sudo pip install virtualenvwrapper
|
||||||
|
|
||||||
|
|
||||||
|
Creating virtualenv and installing OpenCAFE
|
||||||
|
---------------------------------------------
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
# Requires virtualenv and virtualenvwrapper to be installed
|
||||||
|
mkvirtualenv OpenCAFE
|
||||||
|
|
||||||
|
# Clone OpenCAFE Repo
|
||||||
|
git clone git@github.com:stackforge/opencafe.git
|
||||||
|
|
||||||
|
# Change directory into the newly cloned repository
|
||||||
|
cd opencafe
|
||||||
|
|
||||||
|
# Install OpenCAFE into your virtualenv
|
||||||
|
pip install . --upgrade
|
||||||
|
|
||||||
|
|
||||||
|
Information regarding the operation of your virtual environment can be found here: :ref:`working_with_virtualenv`
|
||||||
|
|||||||
45
docs/source/getting_started/virtualenv/index.rst
Normal file
45
docs/source/getting_started/virtualenv/index.rst
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
.. _working_with_virtualenv:
|
||||||
|
|
||||||
|
===================================
|
||||||
|
Working with virtual environments
|
||||||
|
===================================
|
||||||
|
For a complete guide on using virtualenv, please refer to the `virtualenv <http://www.virtualenv.org/>`_ and `virtualenvwrapper <http://virtualenvwrapper.readthedocs.org>`_ documentation
|
||||||
|
|
||||||
|
|
||||||
|
Using virtualenvwrapper
|
||||||
|
=========================
|
||||||
|
There are four primary commands that are used to manage your virtual environments with virtualenvwrapper.
|
||||||
|
|
||||||
|
Create
|
||||||
|
-------
|
||||||
|
When you create a virtualenv with virtualenvwrapper it creates a virtual environment within the $HOME/.virtualenvs folder.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
# Allows for you to new create a virtual environment based
|
||||||
|
# on your current python version(s)
|
||||||
|
mkvirtualenv CloudCAFE
|
||||||
|
|
||||||
|
|
||||||
|
Activate Environment
|
||||||
|
----------------------
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
# Activates a virtual environment within your current shell.
|
||||||
|
workon CloudCAFE
|
||||||
|
|
||||||
|
|
||||||
|
Deactivate Environment
|
||||||
|
----------------------
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
# Deactivates a virtual environment within your current shell.
|
||||||
|
deactivate
|
||||||
|
|
||||||
|
|
||||||
|
Remove Environment
|
||||||
|
----------------------
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
# Deletes a virtual environment from your system.
|
||||||
|
rmvirtualenv CloudCAFE
|
||||||
Reference in New Issue
Block a user