Virtualenv setup with python3

Project setup with virtualenv.

While working with a pyhon3 project, it is better to install project based dependencies inside a project wise virtualenv created.

It helps to minimise the interference of different versions of python modules into different projects.

Project setup with virtualenv
```shell
# Create a project working directory
$ mkdir /my/path/to/project/dir

# Go to working directoyr
$ cd /my/path/to/project/dir

# Create a virtual env in working directory with name ashuenv using venv module
$  python3 -m venv ashuenv

# Clone the project in same working directory
$ git clone clone_url
# Now this cloned repo directory and virtualenv directory, sbenv, both are into same working directory.

# To activate virtual envrionment.
$ source ./ashuenv/bin/activate

# Check virtual environment python
$ python --version
$ which python

# To exit activated virtual environment use
$ deactivate

# Go to project repo dir install dependencies
$ cd cloned_dir_name
# Install project dependency with requirement.txt

$ pip install -r requirements.txt

Leave a Reply

Your email address will not be published. Required fields are marked *.

*
*
You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>