Skip to main content

How to use pip for Python 3 alongside Python 2?

pip is a package management system used to install and manage software packages written in Python.You can find many third party packages on Python Package Index(PyPI). There are currently  94060 packages here.You can browse all of the packages at the following link 


So to use pip for Python 3 alongside Python 2, Follow this steps:

Step 1:


First of all, you have to install both python versions.If you haven't installed it already you can see my other post how to install python 2 and python 3 on Windows PC.
                                         
Make sure to check  Add python 3.5 to path while installing Python 3.

Step 2:


After installation, you have to setup your path for pip (for Python 2) in your windows PC. To do that first of all copy the following path 

C:\Python27\Scripts

Make sure this path matches your Windows' Python 2 path.So please crosscheck before applying this.Otherwise, this method won't work.

Step 3:


  • Go to Control Panel\System and Security\System  
  • Go to Advanced System Settings,
  • Click on Environment Variables 
  • Double click on Path  
  • Click on New 
  • Add the path of  which is provided in Step 2.

Congratulations! Now you can use pip for both versions of python separately:

To use pip for Python 2 just type pip2 in command prompt

To use pip for Python 3 just type pip3 in command prompt

So if you use pip3, pip will install all the packages only for Python 3. It will have not any effect on Python 2. So as you expect, pip2 will only install for Python 2.

Hope this helps :)







Comments

Popular posts from this blog

Python 2 vs Python 3 Pystone benchmarking test!

When Python 3 came out, It was slower than Python 2. As Python's official blog says Python 3 is 10% slower than Python 2. So it means Python 2 is faster than python 3 by some margin. In this Benchmarking, we will use Pystone benchmarks to compare Python 2 and Python 3. My system specification is listed below: CPU = Intel core i3 2100 @ 3.10 GHZ GPU = Nvidia Geforce 210 RAM = 2 GB OS = Windows 10 Pro The benchmarking results may vary upon your system specification. Here's the result. python 3 pystone benchmarks python 2 pystone benchmarks As you can see python 2 has 24% higher benchmarks than python 3 which is pretty impressive. Maybe this is one of the reasons that some programmers prefers to use Python 2 instead of Python 3. Hope this helps :)

Getting error while installing Scipy using pip3 for 64 bit version of Python ? Here's the solution!

As you know Scipy is one of the most used modules by the Python programmers for Data science and Machine Learning. So if you have ever try to install Scipy using pip3 (3 for Python 3!), you will get an error like this. As you can see, to install Scipy , simple pip3 install scipy  will not work. To install Scipy, you have to go to Unofficial Windows Binaries for Python Extension Packages  link. Then you have to find for Scipy. If you are using Chrome, you can use cntrl + F to search for scipy. I m using python 3.5 (64-bit) so I have downloaded this package. Make sure to install numpy before scipy otherwise this method wont work. To install numpy, simple pip3 install numpy   won't work . You have to download numpy + mkl from the same link and download it, then install it using pip. To install numpy and scipy wheel file you have to use pip  install  <path of the wheel file> As you can see,pip has successfully installed Scipy. Hope this he

A Typical Guide to Exceptions in Python

In this blog, I will give you the basic but important information regarding the Exceptions in Python. As we all know, we always get some Errors and Exceptions in program every now and then, so to know what that exception is all about. We should know all about exception. So, let's dive into it. First of all, let's understand what Exception is? If a statement or expression is syntactically correct, it may cause an error when an attempt is made to execute it. This errors detected during execution are called Exceptions. Example:-  Exceptions are of different types and this  error message indicates what happened. Like you see here in example i.e. ZeroDivisionError, NameError, TypeError. These are basic errors in the program. List of Standard Exception :- Exception - Base Class for all the exception Stop Iteration - Raised when the next() method of an iterator does not point to any object. Example :- System Exit - Raised by the sys.exit(