Sunday, February 2, 2014

Install python on windows 8.1 with distribute, pip, virtualenv and virtualenvwrapper-powershell .

Today I wand to show you something new. The goal is using python under Windows OS (Windows 8.1).

This tutorial will cover the instalation of Python 2.7 with distribute (0.7.3), pip (1.5.2), virtualenv (1.11.2) and virtualenvwrapper-powershell.

The default instalation folder I used is under C: drive

I used python 2.7.6.

It's a executable file ... just run it.

Now you have: C:\Python27\ folder with all files.

We need to using also the fork of the Setuptools project named distribute.

Download distribute zip file from python distribute 0.7.3.

Unarhive the file under C: drive and you will have C:\distribute-0.7.3 folder.

Go to distribute and let's install it.

C:\>cd distribute-0.7.3
C:\distribute-0.7.3>\Python27\python.exe --help
C:\distribute-0.7.3>\Python27\python.exe build
C:\distribute-0.7.3>\Python27\python.exe install

Also we need to install pip , see this pip webpage.

You need to get this python script from here.

Put this script into C:\Python27 folder and use this command to install pip.


Under site-packages you can see the pip and distribute ...

C:\Python27\Lib\site-packages>dir /w
 Volume in drive C has no label.
 Volume Serial Number is 9AE5-9AC9

 Directory of C:\Python27\Lib\site-packages


Let's see if this python modules working ...

Python 2.7.6 (default, Nov 10 2013, 19:24:24) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import distutils
>>> import pip

Edit your environment variable by adding: ";C:\Python27\Scripts\" and ";C:\Python27\", see image below:

After that you can restart the command shell or your windows os.

I just restart the command shell and working well with the new environment vars...

Now we need to install virtualenv and virtualenvwrapper-powershell using pip:

C:\>pip install virtualenv
C:\>pip install virtualenvwrapper-powershell

The virtualenv kit provides the ability to create virtual Python environments that do not interfere with either each other, or the main Python installation.

And virtualenvwrapper-powershell it's a PowerShell clone of Doug Hellmann's virtualenvwrapper.

C:\Python27>pip list
distribute (0.7.3)
pip (1.5.2)
setuptools (0.8b2)
virtualenv (1.11.2)
virtualenvwrapper-powershell (12.7.8)

... and this is all for today.


Alex Grönholm said...

Please don't advocate the installation of distribute. It's been deprecated ever since it joined back up with setuptools.
Secondly, since pip 1.5.1, will automatically download setuptools for you.

Catalin George Festila said...

yes , this is the main reason I don't speak about setuptools ...also the main reason I make this tutorial is : I will come with many tutorials about python and windows and is need to make the first one - not advocate anything . Thank you for your comment.

Alex Grönholm said...

What I mean is that people should not be instructed to install distribute, but to instead run which will install both setuptools and pip. Would you mind correcting your post with that in mind? Thanks!

John Gill said...

Have you had any success getting pip to install packages that require building of C extensions? I have failed miserably to get this working. I am using 64-bit python which complicates the whole thing.

Alex Grönholm said...

I have, but I have Visual C++ installed and configured while doing so. Most of the time you shouldn't have to, though, since the authors should be uploading Windows binary wheels for their distributions.

Scott MacGregor said...

@John Gill - use the VCForPython package ..

Post a Comment