
How to Install Python 3 PIP and Virtualenv for a Data Scientist Environment

Thank you for visiting this tutorial. Iβve personally crafted every aspect of this blog, and Iβm delighted to share with you what Iβve learned about AI. π
In this section, Iβll guide you through the best practices for installing and setting up a Python development environment. Installing Python can sometimes be tricky, especially when deciding between Python 2.7 and Python 3+. Iβll also explain how virtual environments (venv) work and demystify the meaning of PEP (Python Enhancement Proposal). ππ»
So, sit back, relax β, and letβs dive in !
1. Getting Started with Python
To start our journey, Iβve signed up for several Python courses designed with data scientists in mind. π These courses cover everything from the fundamentals of Python programming to advanced topics such as data manipulation, analysis, and developing machine learning models.
By completing these courses, weβll build a strong Python foundation, empowering us to tackle sophisticated projects like constructing LLMs confidently. π
We will use Jupyter and VSCode, and you can find all the source code on my GitHub repository. π»
2. Python introduction
π€ What is the version of Python?
π‘ We have two options: Python 2.7 and Python 3+. Spoiler alert: Python 2.7 is not compatible with the latest Python versions (specifically version 3 and higher), and Python 3+ does not maintain backward compatibility with older versions. Therefore, for our purposes, we will exclusively use Python version 3 or higher throughout this blog.
π€ What is PEP?
π‘ PEP stands for Python Enhancement Proposal. Itβs a document that provides information for Python developers or explains new features for Python. PEPs offer technical specifications for Python, making them easy to understand and implement in coding practices.
π€ What is pip?
π‘ pip is the package installer for Python. It allows you to easily install and manage Python packages from the Python Package Index (PyPI). Whether youβre adding libraries for data analysis, web development frameworks, or tools for machine learning, pip simplifies the process by handling dependencies and ensuring packages are installed in your Python environment. Itβs an essential tool for Python developers to extend the functionality of their projects efficiently.
π€ What is venv?
π‘ venv is a Python module used to create virtual environments. Each environment can independently manage its own Python package versions within its directory. Itβs a straightforward tool that ensures clean and isolated environments for different projects.
Easy peasy lemon squeezy!Β π
3. Installation
Now, letβs dive into setting up our Python environment βΒ itβs code time!Β ππ¨βπ»π©βπ»
Linux
For the Linux environment, please note that the code below has been verified onΒ Ubuntu. Make sure to verify your operating system version and adapt the commands accordingly β¨.
$ python3 --version
Python <strong>3.11.6</strong> #version 3.X.Y (3.11.6 on my linux machine)JavaScript- Check Python local version (if installed)
If theΒ PythonΒ command is not found, youβll need to install Python π.
- Installation Python 3 or higher
<code>$ sudo apt-get update
$ sudo apt-get install python3
</code>JavaScriptAfter updating and installingΒ Python 3, now you need to check if Python 3 has been installed correctly β
<code>$ python3 --version
Python 3.11.6 # version 3.X.Y (3.11.6 on my linux machine)
</code>
JavaScriptIf the version of Python is displayed, it means Python is installed and available in your terminal context.
Happy coding !Β Letβs move on to the next step. π
- Use Python 3 and print βHello, World!β :
<code>$ python3
Python 3.11.6 (main, Oct 8 2023, 05:06:43) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print('Hello, World!') # print hello world on your terminal
Hello, World!
</code>JavaScriptCongratulations on your first βHello, World!β in Python! ππ Keep up the great work!
- Install virtualenv (Recommanded)
Firstly, you should install pip π οΈ, This command will update your package index and then install pip for Python 3 on your system.
<code>$ sudo apt update<br>$ sudo apt install python3-pip<br></code>JavaScriptCheck if pip installed correctly by running the following command: π»π
<code>$ pip3 --version<br>pip 24.0 from $HOME/.local/lib/python3.11/site-packages/pip (python 3.11)<br></code>JavaScriptCool π! To install and use virtualenv in Python, you just need two command lines. Hereβs how to update and initialize a virtual environment (venv):
These commands first install virtualenv using pip and then initialize a virtual environment named .venv in the current directory.
<code>python3 -m pip install --user virtualenv<br>python3 -m venv .venv # init .venv on current directory<br></code>JavaScriptWohooo, congratulations! π Youβre now on the latest step.
Youβve installed Python 3 and initialized a virtual environment (venv). Just so you know, venv creates all necessary data and imports Python libraries into the current directory.
Letβs take a look at the .venv directory π.
$ tree .venv
.venv
βββ bin
β βββ activate
β βββ activate.csh
β βββ activate.fish
β βββ Activate.ps1
β βββ pip
β βββ pip3
β βββ pip3.11
β βββ python -> python3
β βββ python3 -> /usr/bin/python3
β βββ python3.11 -> python3
βββ include
... More filesJavaScriptποΈ Windows ποΈ
ποΈ MAC OS ποΈ
Conslusion
Now that Python is installed, itβs time to kick off your project and dive into coding with Python 3! π
This language is beloved by many for its straightforward syntax and wide range of applications. Whether youβre just starting out or youβre a seasoned pro, Python 3 is perfect for everything from building web apps and automating tasks to crunching data and creating machine learning models.
So, roll up your sleeves, fire up your IDE, and letβs bring your ideas to life with Python! π»π
Thank You for Reading this Blog and See You Soon! π π
Let's connect π
Latest Insights
Deep dives into AI, Engineering, and the Future of Tech.

I Tried 5 AI Browsers So You Donβt Have To: Hereβs What Actually Works in 2025
I explored 5 AI browsersβChrome Gemini, Edge Copilot, ChatGPT Atlas, Comet, and Diaβto find out what works. Here are insights, advantages, and safety recommendations.
Read Article


