Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

Tuesday, November 14, 2017

Creating a Python Virtual Environment – Step by Step

Hello Techkie,

It’s been a while since my last post. I got caught up with some personal and technical hurdles — but I’m back on track now, ready to share more useful content.

Today, I’ll walk you through how to create and manage a Python virtual environment, a crucial tool for isolating dependencies in your Python projects.


Why Use a Virtual Environment?

A virtual environment allows you to:

  • Keep your project’s dependencies separate from system-wide packages

  • Avoid conflicts between multiple Python projects

  • Easily manage and reproduce environments for development or deployment


Step 1: Install virtualenv

First, ensure you have pip installed. Then run:

bash

sudo pip install virtualenv

If you're using Python 3+ and want to be explicit:

bash

sudo pip3 install virtualenv

Step 2: Create a Virtual Environment

Run the following command to create a virtual environment:

bash

virtualenv -p /usr/bin/python3.5 myenv
  • Replace /usr/bin/python3.5 with the Python interpreter of your choice.

  • Replace myenv with your desired environment name.


Step 3: Activate the Virtual Environment

To activate the environment, run:

bash

source myenv/bin/activate

Once activated, your terminal prompt will change to show the active environment. You can now install packages using pip, and they’ll be scoped to this environment.


Bonus: Deactivating the Environment

To deactivate the environment and return to the global Python setup:

bash

deactivate

Summary

Using virtual environments is a best practice in Python development. It’s quick to set up, easy to use, and essential for managing multiple projects with different dependencies.

Let me know if you’d like a follow-up post on using venv (the built-in alternative) or managing environments with pipenv or Poetry.

Wednesday, January 27, 2016

My First Python Meetup Experience – Python 3, Pune 23 Jan 2016




Firstly, I would like to extend a sincere thank you to the organizers of the "Python 3 - 101" Meetup in Pune for arranging such a well-executed and engaging event.

This was my first time attending a Python meetup, and also my first blog post about a community event. As someone who is new to Python, this experience was both exciting and inspiring.


What Made It Special

  • The atmosphere was welcoming, and the learning environment was encouraging.

  • I had the opportunity to connect with fellow learners and experienced developers.

  • The hands-on approach and supportive community gave me a strong motivation to continue exploring Python.


A Note of Thanks to Kushal Das

Our mentor for the session, Kushal Das, led the event with clarity and enthusiasm. He introduced us to beginner-friendly exercises such as:

  • FizzBuzz

  • GetPass and secure input handling

While I couldn’t fully grasp all the concepts right away — being a beginner — the way the topics were presented helped me build a foundational understanding and a strong desire to learn more.

Thank you, Kushal Sir, for your guidance and for making the learning journey approachable for newcomers like me.


Appreciation for Red Hat

I would also like to thank Red Hat for providing the venue and supporting the local Python and open-source community.


Looking Ahead

This meetup has significantly boosted my interest in Python. I’m excited to continue learning, practicing, and contributing as I grow.

Thank you again to all the organizers, mentors, and participants for making this such a valuable experience.