Anda di halaman 1dari 65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Anthony DeBarros :: on data, code & product


About Articles Awards Code Clips Contact

Setting up Python in Windows 7


OCT 15, 2011 | 141 COMMENTS

An all-wise journalist once told me that everything is easier in Linux, and after working with
it for a few years Id have to agree especially when it comes to software setup for data
journalism. But
Many newsroom types spend the day in Windows without the option of Ubuntu or another
Linux OS. Ive been planning some training around Python soon, so I compiled this quick
setup guide as a reference. I hope you nd it helpful.
Set up Python on Windows 7
Get started:
1. Visit the of cial Python download page and grab the Windows installer. Choose the 32-bit
version. A 64-bit version is available, but there are compatibility issues with some modules
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

1/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

you may want to install later. (Thanks to commenters for pointing this out.)
Note:Python currently exists in two versions, the older 2.x series and newer 3.x series (for a
discussion of the differences, see this). This tutorial focuses on the 2.x series.
2. Run the installer and accept all the default settings, including the C:\Python27 directory
it creates.

3. Next, set the systems PATH variable to include directories that include Python components
and packages well add later. To do this:
Right-click Computer and select Properties.
In the dialog box, select Advanced System Settings.
In the next dialog, select Environment Variables.
In the User Variables section, edit the PATH statement to include this:
C:\Python27;C:\Python27\Lib\sitepackages\;C:\Python27\Scripts\;

4. Now, you can open a command prompt (Start Menu|Accessories or Start Menu|Run|cmd)
and type:
C:\>python

That will load the Python interpreter:


Python2.7.3(default,Apr102012,14:24)[MSCv.150032bit(Intel)]onwin32
Type"help","copyright","credits"orlicenseformoreinformation.
>>>
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

2/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Because of the settings you included in your PATH variable, you can now run this interpreter
and, more important, a script from any directory on your system.
Press Control-Z plus Return to exit the interpreter and get back to a C: prompt.
Set up useful Python packages
1. setuptools offers the helpful easy_install utility for installing Python packages. Grab the
appropriate version for your system and install.
2. pip is another package installer that improves on setuptools. Having pip and setuptools
will cover most of your installation needs, so go ahead and add pip. Now that youve installed
setuptools, you can add pip by typing the following at any Windows command prompt (not in
the Python interpreter):
C:\>easy_installpip

Notice that easy_install executes without needing to be told where on the system its located.
Thats the bene t of adjusting your PATH variable earlier.
3. Mechanize and BeautifulSoup are must-have utilities for web scraping, and well add those
next:
C:\>pipinstallmechanize
C:\>pipinstallbeautifulsoup4

4. csvkit, which I recently covered here, is a great tool for dealing with comma-delimited text
les. Add it:
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

3/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

C:\>pipinstallcsvkit

Youre now set to get started using and learning Python under Windows 7. If youre looking
for a handy guide, start with theOf cial Python tutorial.
Need to set up on Windows 8.1? Heres my guide.

Related

Setting up Python in Windows 8.1


02/16/2014
In "Programming"

Setting up Python in Windows 10


08/16/2015
In "Programming"

Generate JSON From SQL Using


Python
03/11/2012
In "Programming"

PROGRAMMING, PYTHON

141 responses to Setting up Python in Windows 7

Anthony

10/15/2011 at 12:49 pm

Any other useful utilities to add?

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

4/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Mike Stucka

11/05/2011 at 8:28 pm

You probably ought to tell em speci cally to download the older, 2.7 version, as
3.1 is listed as well.
Looks awfully useful, though thanks!

Anthony

11/06/2011 at 3:45 pm

Duly noted, Mike. Thanks!

Ian

01/31/2012 at 2:41 pm

Thanks Anthony! As a long time Mac/Linux user, this tutorial was incredibly
helpful in setting me up with a Python environment for my fresh Windows7
install.

Anthony

01/31/2012 at 2:56 pm

Glad it was helpful! A bunch of people are getting ready for some Django training
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

5/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

at work this week, and someone passed this link around:


http://docs.python-guide.org/en/latest/starting/install/win/
Some good tips in there too.

Fresh from #nicar12, here are curated notes to set up a Windows 7 Python environment so I
can practice at work | Madison.com Labs Blog
02/29/2012 at 1:25 pm

[] following are bullet points gathered from walkthroughs created by Anthony DeBarros
and the Kenneth Reitzs Python Guide to get a Python development environment up and
running []

Sumit Kumar Jha

05/17/2012 at 4:47 am

My python compiler is showing message:

Traceback(mostrecentcalllast):
File"F:\Python\latex2wp.py",line657,in
s=extractbody(s)
File"F:\Python\latex2wp.py",line140,inextractbody
foriinrange(1,(len(L)+1)/2):
TypeError:'float'objectcannotbeinterpretedasaninteger
>>>
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

6/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Please help

Anthony

05/17/2012 at 10:41 am

Sumit,
It seems that your code is attempting to load an object of type oat into an
integer. Im guessing thats due to the division operation occurring in the range
method.
You may want to explore StackOver ow or scan the Python docs for handing type
casting.

Joshua Grigonis

06/03/2012 at 12:25 am

I recommend installing 32 bit, unless you need 64 bit. No, you probably dont
need 64 bit.

Jussi Jumppanen

06/03/2012 at 4:27 am

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

7/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Another way to install and run Python code on Windows is to download and
install the Zeus IDE, create a new Python le and then use the run menu to run
the script. And here is a video to see for yourself
http://www.youtube.com/watch?v=9vchdcLFW54

Anthony

06/03/2012 at 8:31 am

Joshua: Thanks. Youre right, and Ive updated the post to point people to 32-bit.

Tom

06/11/2012 at 12:24 pm

Or you can use npackd to install and optionally upgrade if need ever arises.

Ken Pierce

06/22/2012 at 12:16 am

For some reason the python set-up universe eludes me. For instance I was trying
to run easy_install in python. Once I realized that the emphasis was cmd prompt,
not python prompt it fell in place. A note to that effect might really help the
uninitiated.

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

8/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Anthony

06/22/2012 at 8:25 am

Ken: Thanks; thats a good point about differentiating between the Windows cmd
prompt and the prompt inside the Python interpreter. I added some words to
emphasize that.

Marion

08/09/2012 at 1:48 pm

I installed python on my computer, I have windows 7, but when i write python on


the command prompt it displays the following message: python is not
recoghnizes as an internal or external command, operable program or batch le.
How can I x this issue?
Thanks

Anthony

08/09/2012 at 1:52 pm

Marion, you need to follow Step 3 in my tutorial above.

Henry

08/13/2012 at 3:41 pm

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

9/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Im getting this error when installing mechanize module in python 3.2


-

C:\>pipinstallmechanize
Downloading/unpackingmechanize
Downloadingmechanize0.2.5.tar.gz(383Kb):383Kbdownloaded
Runningsetup.pyegg_infoforpackagemechanize
Installingcollectedpackages:mechanize
Runningsetup.pyinstallformechanize
File"C:\Python32\Lib\sitepackages\mechanize\_beautifulsoup.py",line267
raiseAttributeError,"'%s'objecthasnoattribute'%s'"%(self.__clas
s__.__name__,attr)
^
SyntaxError:invalidsyntax
...snip...
Successfullyinstalledmechanize
Cleaningup...

it nished saying successfully installed mechanize. When importing mechanize


in a script it triggers an error, any clue?

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

10/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Anthony

08/13/2012 at 9:48 pm

Henry,
Youre getting the error because Mechanize does not support Python 3.x at this
time.
Ive edited your comment for readability.
See http://wwwsearch.sourceforge.net/mechanize/faq.html

Meklit

08/23/2012 at 1:05 am

Hi Anthony,
I have tried to install python 2.7 on my windows7 following the steps but it failed
and the following message pops up. An error occurred during the installation of
assembly Microsoft.VC90.CRT, version = 9.0.21022.8
publickeytoken=1fc8b3b9a1e183b,processorArchitecture=x86,type=win32
I noticed that I have the 2.5 version and I assume this is while I was installing
ARCGIS on my pc. I wouldnt mind using the 2.5 version the only problem is I
cant get the langague interpreter run as per your stepsI get the following
message python is not recoghnizes as an internal or external command, operable
program or batch le.Any insight??

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

11/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Anthony

08/23/2012 at 9:30 am

Meklit,
Sounds like your system may have had a problem with a prior Windows install. A
little Googling turned up this: http://support.microsoft.com/kb/970652
That said, if you want to use the Python 2.5 install that ESRI includes with
ArcView, you should be able to by modifying the system PATH I mention in Step 3
above to point to the required Python components.
The only issue is that, at least on my system, I see that ESRI adds a directory
between the Python folder and the components. So, for me, Id have to set the
PATH to:

C:\Python26\ARCGIS10.0C:\Python26\ARCGIS10.0\Lib\sitepackages\C:\Python27\ARCGIS10.0\S

shubhasmita sahani

08/24/2012 at 5:35 am

hi ,
i trying to learn Python by self.I amusing widows -7 32 bit machine ,i am facing
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

12/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

some problem while installing it.Can anyone please gove a proper link and
proper setup which will exactly sit on my machine properly. I will be reallt
greatful. Thank you.

Anthony

08/24/2012 at 2:20 pm

shubhasmita,
Without more details I dont think I can help.

Dusti

09/08/2012 at 12:23 pm

I just wanted to add a note to let you know that I am new to the whole idea of
programming and am trying to take a class that required python. I cant tell you
how helpful this little tutorial was. Thank you so much for taking the time to put
this up here.
sincerely,
Dusti
To get something you have never had,
you must do something you have never done.

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

13/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Anthony

09/09/2012 at 7:57 pm

Dusti,
Really glad it helped!

Lubaba

09/16/2012 at 11:05 am

Hi Anthony,
I installed python 2.7.3 (python-2.7.3.msi for windows) on my windows 7 machine.
However, I could not run python scripts from Python GUI IDLE. I am getting an
error Theres an error in your program: invalid syntax each time I try to run my
script. I tried to run the same script from python command prompt, it worked.
What could be the possible reason of this issue? As I am not very comfortable
working on command line, it would be a great help if you could offer a solution.
Thanks.

Anthony

09/16/2012 at 2:41 pm

Lubaba,
I never use IDLE so I dont have a lot to offer for troubleshooting. I found this
from a quick Google search:
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

14/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

http://stackover ow.com/questions/6513967/running-python-script-from-idle-onwindows-7-64-bit

Matthew

09/20/2012 at 10:39 pm

i downloaded python and changed the path variable to


C:\Python27;C:\Python27\Lib\site-packages\;C:\Python27\Scripts\;
and i go on cmd prompt and type C:\> python and i get this
C:\ is not recognized as an internal or external command, operable program or
hatch le
plz help!
thanks

Anthony

09/20/2012 at 10:54 pm

Matthew,
Just type python. In the example, the C:\ represents the prompt itself.

Matthew

09/22/2012 at 4:32 pm

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

15/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

ok thanks you are a life saver

Dacio

09/25/2012 at 9:44 am

Hi Anthony
I installed python 2.7.3 in my box running windows 7 32 bits. Everything was ne
until I wanted to print from my program, Then I got : ImportError: no module
named win32print.
This is what I get about my path:

>>>importsys
>>>>printsys.path
['','C:\\Python27\\Proyectos\\%PYTHONPATH%','C:\\My_python_lib','C:\\Windows\
\system32\\python27.zip','C:\\Python27\\DLLs','C:\\Python27\\lib','C:\\Python
27\\lib\\platwin','C:\\Python27\\lib\\libtk','C:\\Python27','C:\\Python27\\
lib\\sitepackages']

please any suggestion/advice.


thanks in advance

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

16/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Anthony

09/25/2012 at 11:06 pm

Dacio,
Havent run into that one. Perhaps this helps?
http://www.blog.pythonlibrary.org/2010/02/14/python-windows-and-printers/

Karl

10/12/2012 at 7:21 am

Anthony
Thank you very much this was a very easy to follow and very useful tutorial. You
have saved hours of web browsing.

h-man

10/20/2012 at 5:32 pm

Ive followed your direction installing Python 2.7.3 32 bit on Win7 64 bit HP.
Python starts in command prompt but IDLE will not start from Start/All
Programs/python27. Any ideas?

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

17/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Anthony

10/20/2012 at 5:57 pm

h-man,
Hmm. Thats one of those situations thats dif cult to diagnose because its
probably related to something speci c on your machine. I do see that others have
run into the problem this thread discusses a rewall as being an issue:
http://bit.ly/S8xRRQ

Jeff

10/30/2012 at 11:54 am

Do you have a recommendation for a text editor? It would be useful to have a


color coded script

Anthony

10/30/2012 at 12:04 pm

Jeff,
I particularly like Sublime Text 2, which you can try for free. Buying a license
allows for installation on multiple machines.
A lot of coders swear by Vim, which has its own paradigm for editing and requires
some time to learn. Ive used it and its a must if youre going to work on
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

18/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

remote servers but I still like Sublime better.

John

11/05/2012 at 2:19 am

I have set up the path to C:\Python27\Lib\site-packages\;C:\Python27\Scripts


and I cant run the scrip by > python full\path\to\myscript.py command on
window 7
so what shall i do
thnaks

Anthony

11/05/2012 at 8:38 pm

John,
What error message do you receive?

Iris

11/23/2012 at 8:23 pm

Hi Anthony,

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

19/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Thank you very much for the clear and to-the-point tutorial
lot of searching and headache.

csbellina

It has saved me a

11/28/2012 at 11:02 pm

This was SO SO SO SO SO SO helpful!!!! thank you so much!

Anthony

11/29/2012 at 8:05 am

Iris, csbellina,
Youre both very welcome. Its been rewarding to be able to help people.
Ironically, I recently moved from Windows to OS X for my daily work and found
myself frantically searching for good Python setup guides!

dran001

11/30/2012 at 1:28 pm

Here is a very important one for ArcGIS desktop.


Besides setting your PATH environment variable, add a new variable
PYTHONPATH if it is missing, and set/add ;%ArcGISHome%\bin.
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

20/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

In my case, it looks like: PYTHONPATH=C:\ArcGIS\bin


when it type >set PYTHONPATH in a cmd window.
For some reason this was missing when I installed ArcGIS desktop 9.3.1 in
Windows 7.

Alejandro

12/26/2012 at 9:49 pm

Ive been searching for a tutorial that in a really concrete and easy way describes
the process to install python and pip. This is just what I was searching for! Thanks
man!

windmill

12/28/2012 at 1:08 pm

Dear Anthony
I have struggling to load the interpreter section 4 system throws up an error
message
windows cannot nd c:\> python directory

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

21/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Anthony

12/28/2012 at 2:57 pm

Windmill,
Make sure youre only typing python at the C: prompt and not C:\> python.

Sandepp

12/30/2012 at 12:29 pm

Thank you Anthony it was very helpful for windows refugee(me)

Andrew

01/05/2013 at 9:40 pm

Excellent article mate !! Got me up and running with python in no time . Keep up
the good work.

wani

01/28/2013 at 3:54 am

i already installed python 2.7.3 on my system(window 7)


i can run simple python code
but,i face a problem when i want to run script that contain import beautifulsoup
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

22/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

do i need to install all those setuptools,pip and mechanize to make its working??
i have googled for the solution for days about how to install the beautifulsoup
unto my python,but,still i couldnt nd any right solution..
i keep uninstalling if it does not working
could u please help me how can i make it work on my system??

Igor

01/28/2013 at 2:16 pm

Thanks a lot for the article!

Anthony

01/28/2013 at 4:59 pm

wani,
I am con dent that if you install setuptools and then pip, you can install Beautiful
Soup with pip as I mention above. The Mechanize library is not a prerequisite for
Beautiful Soup.

wani

01/29/2013 at 1:08 am

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

23/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

tq so much anthonyso helpful!!

tunde

02/17/2013 at 6:26 am

hello, i installed python 3.3 please and it seem this article talks abt 2.7 only..any
help regarding python 3.3 as i am a novice in programming..i have installed the
python 3.3 and when i type python python at start, the only programs i see are
python(command line) and IDLE(python GUI). I cant nd anything like python
interpreter and i dont know how to go about writing and running the python
codes. The little amount of python that i learnt was learnt online and the
interpreter was online too, so now, i want to start soding of ine. Help please

Anthony

02/17/2013 at 7:43 am

tunde,
You should set your PATH variable according to the directory where Python 3.3
was installed. It would probably be something like:

C:\Python33C:\Python33\Lib\sitepackages\C:\Python33\Scripts\

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

24/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Then, you should be able to type python at a command prompt to launch the
interpreter. Beyond that, the various Python libraries I mention here may or may
not be available under 3.3 youll have to do some research.

jeff

02/18/2013 at 1:31 am

I am having trouble with python, django, heroku install.


ive run:

pythonwinservice_install

because djcelery has to be run as a web service on windows 7 (64 bit)


but when i run:

pythonmanage.pywinservice_install

it tells me it cant nd win32api


pprint(sys.path) includes
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

25/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

D:\\apps\\python\\lib\\site-packages\\win32,
D:\\apps\\python\\lib\\site-packages\\win32\\lib,
and one of these directories has: win32api.pyd is that what it wants?
Im a beginner with python, heroku, and django: its been an entire day and I
would like to know how to have python nd win32api
thanks!

Anthony

02/18/2013 at 8:54 am

Jeff,
Sorry, but I dont readily have the answer to your question. But I do have a
broader suggestion:
If youre going to be developing a Django app, Id strongly suggest you do so on
Linux or Mac OS X. Is it possible to develop a Django app on Windows 7? Sure.
But Ive found over time that installing Python libraries and getting everything
working well is much more complicated compared with running Python under
Linux.
You dont need to have a separate computer, either. Go install VirtualBox (for free)
and download Ubuntu (for free). Guaranteed to make life simpler in the long run.
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

26/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

https://www.virtualbox.org/wiki/Downloads

Marcus

02/23/2013 at 2:04 pm

YOU SIR ARE A HERO! Thank you so much I have been trying to gure this out as
a newbie for a long time and you explain things step by step in easy to follow
instructions for us newbies.

William

03/13/2013 at 3:26 am

Installation of pip for Windows users (I am on Win 7 (x64):


1. cd to the directory where the pip Win installer downloaded from
https://pypi.python.org/pypi/pip was downloaded to.
2. In a Administrators command prompt do the following
> easy_install .
Note:there is a full-stop after the word easy_install
Now you can run commands like
>pip install mechanize
Have fun!
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

27/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

William

03/13/2013 at 3:28 am

Thank you Anthony.


Nice work!

Abhas

03/17/2013 at 12:59 am

Thank you for this whole article. Basically, I am using python for over 6 months
on windows and I always used those python extension installers from unof cial
sites. Sometimes I couldnt even nd some important extension as an installer. It
felt really limited.
And today after I found your article and did all the steps, the whole process felt
like a breeze..
No nerdy compilations, nothing.. Again, thanks
I am actually looking at the date of the post and thinking how some basic posts
can help others for a long time ever after. And btw, now Ill be hunting your site
for other python-related articles..
You just earned yourself a loyal reader
Again, thanks from the bottom of my heart..
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

28/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Shyju Varkey

03/27/2013 at 8:05 pm

Thank you very much for this excellent article. I have been using Python in Linux
for quite some time and wanted to try it on Windows. You article made my work
so easy. I havent found such a detailed and perfect installation guide ever.
Thanks Again.

Maurice

04/04/2013 at 2:49 pm

Making a path environment variable to the folder containing Python.exe is easy.


What you do not explain is how to make Python locate a Python script from a
path setting. For instance I have this Python script in the path C:\Program
Files\pyurlsnooper\pyurlsnooper-gtk.py, but I have to change into the
pyurlsnooper directory to run the script. Adding a Windows path to C:\Program
Files\pyurlsnooper does not make the script accessible to Python anywhere other
than from its installation folder. I tried adding this path to the registry at
HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.7\PythonPath but still
Python cannot locate the script anywhere except from its installation directory.
Could there be a problem with the space in Program Files?
Also what is the point of making WIndows paths to C:\Python27\Lib\sitepackages and C:\Python27\Scripts if these folders do not contain Windows
executables?
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

29/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Anthony

04/04/2013 at 11:51 pm

Maurice,
The reason I add the \site-packages\ and \Scripts\ subdirectories to my PATH is
because I occasionally nd that certain Python libraries seem to need that
reference to function. For example, the csvkit library I recommend in this post
installs Windows .exe les in the \Scripts\ subdirectory.
For the other issue you mention, these might help:
http://docs.python.org/2/install/#inst-search-path
http://stackover ow.com/questions/3701646/how-to-add-to-the-pythonpath-inwindows-7

Rich

04/24/2013 at 1:32 pm

So, I installed Python 2.7 into Win 7 and added the variable as outlined in step 3.
Does it matter what the variable is named? I have tried Python and python, but
when I go to a command prompt, I get the not recognized as a programetc
message. What am i doing wrong?

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

30/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Rich

04/24/2013 at 2:59 pm

I posted a bit ago, looks like it was removed. Anyway, I gured out why it wasnt
working. the Script directory isnt created automatically. Presumably, it does after
the setuptools gets installed, but if one if following step by step, the Scripts
directory must be manually created for step 3 to actually work.

Anthony

04/24/2013 at 6:03 pm

Rich,
Its true that the Scripts directory is not created until SetupTools is installed, but
that shouldnt prevent you from executing python from the command line. One
thing you must do after Step 3 is quit and restart your command terminal for the
new path to be recognized.

Raj

04/24/2013 at 6:17 pm

Hi Anthony,
Im using Python 2.7.2 version / pyodbc 32 bits installed in a Windows 2003
server, which also has IIS server con gured for sending mails. Im trying to
connect through my Excel to Teradata and refresh the graphs / charts / Table. For
the same I have written macros to refresh the table / charts .Through Python Im
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

31/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

retying to open the Excel get a snapshot and send it an email


Im getting the following error

importwin32com.clientaswin32
File"c:\Python27\lib\sitepackages\win32com\__init__.py",line5,in
importwin32api,sys,os
ImportError:DLLloadfailed:%1isnotavalidWin32application.

When I search for solution it looks like I have to install 64 bit Python. But Im
worried whether my other setups will get disturbed. Is there a way that I can
open the Excel / Macro using 32 bit?
Your help is much appreciated. Thanks in advance

Rich

04/24/2013 at 6:42 pm

Hmm. I was restarting the command shell, but as soon as I created the scripts
directory, it worked, even before installing the setup tools. Anyway, besides that, I
got it up and running. Thank you much!

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

32/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Anthony

04/24/2013 at 10:00 pm

Raj: Unfortunately, I dont have enough experience to offer a meaningful answer.

Rob

05/16/2013 at 8:18 pm

Many thanks for this. It made the whole installation process much easier.

Designer Learns to Code: Pt. 1 (Struggles) | The Nostalgia Machine

05/26/2013 at 2:02 pm

[] wish I read this quick and clear guide on how to set up Python in Windows 7 before I
started diving through Pythons []

LoopTools: Flask Microframework : quadloops technologies

06/02/2013 at 2:18 am

[] version, as ask has not yet been ported to python 3. Here is a nice and simple guide to
do that, here( Thanks to Anthony DeBarros for the guide. You can follow []

Ned

06/06/2013 at 2:20 am

This is awesome!!!! Thanks so much for putting this together.


Much love
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

33/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Ned

mahdiye

06/16/2013 at 3:10 pm

hi. i have a problem . i dont know which version i shoulde use for windows 7.
please help me . i really want to know python but im a begginer .i only know
visual basic. help me. which version?? thanks

Anthony

06/16/2013 at 10:57 pm

mahdiye,
If youre just getting started, Id suggest Python 2.7.5, which is the latest version
in the 2.x series. Python 3 is rapidly gaining traction, but there are still a number
of helpful libraries that arent yet ported to version 3 yet. You also can make the
transition later to 3 if your needs change.

mahdiye

06/17/2013 at 6:05 am

Anthony,
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

34/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

thanks Anthony . i downloaded it . i really want to learn python then i


downloaded some v les for learn. the name is : CBT Nuggets Python
Programming Video Tutorials
i watched some of these videos then i started to writting codes but i had some
problems .i followed the codes that i learned but i saw errors like syntax error etc.
look at this :

Python2.7.5(default,May152013,22:43:36)[MSCv.150032bit(Intel)]onwin32
Type"copyright","credits"or"license()"formoreinformation.
>>>defgensq(n):

foriinrange(n):

yieldi**2

>>>a=gensq(4)
>>>a
>>>type(a)
>>>next(a)
0
>>>next(a)
1
>>>next(a)
4
>>>next(a)
9
>>>next(a)
Traceback(mostrecentcalllast):
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

35/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

File"",line1,in
next(a)
StopIteration
>>>defitsq(n):

result=[]

foriinrange(n):

result.append(i**2)

returnresult

>>>b=itsq(4)
>>>b

i know they are ridiculous its because i dont know anything about python and just
followed the codes.
and i have a problem. i cant nd graphycal user interface of python.

sorry my english is not so good . im a iranian 16 girl ^^


. help me

Anthony

06/17/2013 at 3:50 pm

mahdiye,
There are some good books here that might help you get started:
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

36/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

http://pythonbooks.revolunet.com/

zafrul izham

06/24/2013 at 6:36 pm

very usefull..
salute from malaysia

Leslie

07/03/2013 at 11:19 am

Thanks so much. pip install is great. One question on csvkit. I have Windows Vista
32-bit. cvskit commands work ne. But piping and head (the unix shell) does not
work. How do you use csvkit as shown in the csvkit tutorial on Windows? Thanks
so much.

Anthony

07/04/2013 at 10:31 am

Leslie,
If you want to emulate Linux command-line functionality on Windows, your rst
stop should be Cygwin:
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

37/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

http://cygwin.com/index.html

Lesie

07/04/2013 at 3:06 pm

Anthony, I took the advice you gave to someone in this thread about a running
linux as a VM on windows. So I installed VirtualBox and am running ubuntu
server in it. I installed csvkit. I also connected with a terminal running on
windows using putty, so now I am ready to learn bash and use the csvkit. I do
want to do a web application in python. I am currently learning on windows using
google app engine and the built-in webapp2 framework. But when you said it is
easier to do web app development on linux, I decided to install a linux VM. Next
step: I have to buy a new computer with lots of memory and hard disk space so I
can actually do development. Thanks so much for your blog. I am a follower!

Anthony

07/04/2013 at 10:09 pm

Leslie,
That sounds great. VirtualBox with Ubuntu works pretty well. You can also set up
a Windows machine to dual-boot into Ubuntu. Either way, good luck on your
learning. If youre into Python and web development, I suggest you try out
Django.
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

38/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Amy

07/10/2013 at 3:51 pm

Thanks for the great information


Cheers
Amy

Imran

07/13/2013 at 4:46 pm

Hi,
I followed your instructions above to set up Python,
I get the following error message.
C:\>Python33
Python33 is not recognized as an internal or external command,
operable program or batch le.new
I want to know where I have gone wrong?
Thanks.

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

39/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Anthony

07/13/2013 at 6:02 pm

Imran,
See Step 4. The command is python not python33.

Kirsteen Mackay

07/24/2013 at 6:29 am

Thank you for a very useful tutorial in getting Python installed on my Windows 7
machine.

Sharon

07/30/2013 at 11:33 am

Thank you so much! it was so helpful!!!

Anthony

07/30/2013 at 12:32 pm

Kirsteen and Sharon,


Glad to help!
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

40/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Coop

08/05/2013 at 8:44 pm

Hi,
Thank you so much for this tutorial. Im a MATLAB/R programmer attempting to
start using python for some web-scraping, but I am currently a novice with
respect to command-line programming. I followed your rst three steps (I did
modify my PATH), but now, when I type python into a command prompt, I
receive:
python is not recognized as an internal or external command, operable program,
or batch le.
If I change directories to C:\Python27, I can then type python and enter the
interpreter.
Typing:
>>>import sys
>>>print sys.path
Reveals:
[[, ;C:\\Windows\\system32\\python27.zip, C:\\Python27\\DLLs,
C:\\Python27\\lib, C:\\Python27\\lib\\plat-win, C:\\Python27\\lib\\lib-tk,
C:\\Python27, C:\\Python27\\lib\\site-packages]
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

41/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Soif the PATH statements seem correct, why can I not type python from any
command prompt and enter the interpreter? (And subsequently, why can I not
easy_install pip?)
Sorry for the long question Ive been at this for a couple days and have grown
frustrated.

Anthony

08/06/2013 at 10:04 am

Coop,
If you open a command prompt in Windows 7 and type path (without the
quotes) and press Enter, what displays? Most important, are the Python
directories listed there?

Coop

08/06/2013 at 10:16 am

When I enter path (without the quotes, of course) into the command prompt, I
see the following:
PATH=C:\Perl64\site\bin;C:\Perl64\bin;C:\Windows\system32;C:\Windows;C:\Windows\
System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program
Files\Intel
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

42/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program


Files
(x86)\Lenovo\Access Connections\;C:\Program
Files\MATLAB\R2009a\bin;C:\Program F
iles\MATLAB\R2009a\bin\win64;C:\Program
Files\TortoiseSVN\bin;C:\Go\bin;C:\Progr
am Files\MiKTeX 2.9\miktex\bin\x64\;C:\Program Files (x86)\SSH
Communications Se
curity\SSH Secure Shell; C:\cygnus\cygwin-b20\H-i586-cygwin32\bin;
C:\Python27;
C:\Python27\Lib\site-packages\; C:\Python27\Scripts\;
Much of this old stuff that has been in my path for some time. It seems the
python information is present. Am I missing something?

Anthony

08/06/2013 at 10:43 am

Coop,
Edit your path to get rid of any spaces after the semi-colons. Close and re-open
your command prompt window. See if that works.

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

43/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Coop

08/06/2013 at 12:06 pm

Brilliant! Removing the white space xes the problem. Onto the next steps of the
python journey. Thank you so much for the help!

Anthony

08/06/2013 at 12:27 pm

Coop,
Awesome. Its always great when stuff works.

Anca

08/09/2013 at 3:14 am

Hello! Thanks for this tutorial. I am new with python, but I must get better fast :))
Can you tell me some tools of python for dealing with .xml les?

Anthony

08/09/2013 at 7:44 am

Anca,

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

44/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Youll want to look at BeautifulSoup and lxml:


http://www.crummy.com/software/BeautifulSoup/
http://lxml.de/

Justin

08/12/2013 at 1:19 am

I am new to learning Python. I have both Python 2.7 (32 bit) and Python 3.3 (64
bit) on my computer. When I downloaded Python 3.3 it gave the option to adjust
the PATH setting, I did that. I am curious as to if I manually adjust the PATH for
2.7, will it cause any issues with 3.3 also on the comp.? Would I be better off uninstalling 3.3? Any advice would be greatly appreciated!! My goal in learning
Python is to use it in conjunction with MySQL (learning that as well) so that I can
keep updated sports stats databases. (I am hoping beautifulsoup and mechanize
can help with web scraping to keep data up to date)

Anthony

08/12/2013 at 10:28 am

Justin,
Both versions can happily coexist on your machine. You can manually change
your PATH depending on which version youre working with. Other people have
tried other solutions, so its worth Googling to see the possibilities. Example:
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

45/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

http://stackover ow.com/questions/3809314/how-to-install-both-python-2-xand-python-3-x-in-windows-7

Justin

08/13/2013 at 12:51 pm

Thanks Anthony, I ended up just uninstalling python3 until if/when I ever need it.
I have been trying to download setuptools for a couple of days now and having
way more trouble than I probably should be. I have my PATH set accordingly and I
downloaded the top le into my /site-packages directory and unzipped it. Now, I
am supposed to download the ez_setup.py le into the same folder and run it.
This is where I am lost. The le is a web address, so I wasnt sure how to
download it. My thought was to just copy the whole page and paste it into Python
Shell and save it as a ez_setup.py , then run it on the command line. Would that
be the correct strategy? When I try to run the ez_setup.py from the command
prompt I get an error message no such le or directory What am I missing?!? I
check many stackover ow threads to no avail!

Justin

08/13/2013 at 1:07 pm

So, right after I sent my last question, I ran the ez_setup.py le in the Python
Shell to see what would happen and it started to work, downloading different
les and stuff, but not long in there was an error, right after the line that said
installing setuptools, the next line said something went wrong during the
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

46/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

installation. and the next line see the error message above. I noticed a scripts
folder was created, although it was created in a different spot than
python27/scripts, it was created in a sub folder in the site-packages folder called
setuptools-0.9.8-data and the easyinstall.exe le seems to be there. At least from
this point, I can do some more research and try to nd out what went wrong,
hopefully I can gure out an answer.

Anthony

08/13/2013 at 1:26 pm

Justin,
You should just need to download the Windows installer from here and run it:
http://www.python.org/download/
Its a .msi le, which is executable.

Justin

08/13/2013 at 1:46 pm

Sorry, I guess I didnt elaborate clearly, I have Python 2.7 downloaded no


problem, its downloading the setuptools where my issue is. I downloaded it (the
top of the three download links) to the site-packages sub folder then ran
ez_setup.py in the python shell and the download process started, but there is an
error and the process didnt nish. It seems the easyinstall executable le was
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

47/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

created, as was a scripts sub folder, but the scripts sub folder wasnt
Python27/scripts it is Python27/Lib/site-directories/setuptools-0.9.8.data/scripts.
I hope that makes sense.

Anthony

08/13/2013 at 1:50 pm

Justin,
I usually download the le to my desktop and run the .msi installer from there.
This one:
Python 2.7.5 Windows Installer (Windows binary does not include source)

Justin

08/13/2013 at 1:57 pm

Anthony, thanks for trying to help.. maybe I am beyond help at this point! I
already have that le downloaded onto my computer. The problem I am running
into is trying to install the package setuptools that you refer to in the Set up
useful Python packages section of your post.

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

48/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Anthony

08/13/2013 at 2:04 pm

Justin,
My previous comment should be all you need. Dont think I can offer any further
help on this one. Thanks for reading.

Oliver

08/29/2013 at 10:26 am

When installing Python 2.7.5 it says there is a DLL le missing, and the
installation is aborting.
Its right after choosing the installation path.
What to do??

Anthony

08/29/2013 at 10:31 am

Oliver,
Id start with Googling the speci c error message to see whether its a common
problem with a known solution.
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

49/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Oliver

08/29/2013 at 11:15 am

well i have tried to google it, but i havent found anything usefull
here is the error message:
There is a problem with this Windows Installer package. A DLL required for this
install to comlete could not be run. Contact your support personnel or package
vendor.

Oliver

08/29/2013 at 11:30 am

well, i just made it work so have a good day and thanks for replying so fast.

Anthony

08/29/2013 at 11:31 am

Oliver,
Care to share your solution? A lot of people come to this post could help
someone out there.

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

50/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

C.B.L.F.

10/11/2013 at 7:30 pm

Hi Anthony,
Thank you for this info. I do have one question in regards to step 3 under setting
up python. When I get to the environment variables window, there exist a Path
variable for User and System. Do I need to edit/update both User and System path
variable with the statement you prescribed?

Anthony

10/11/2013 at 9:32 pm

Hi, C.B.L.F.,
The User variable section is the only one you need to change.

kev

10/14/2013 at 9:27 pm

Wow. thank you. Spent hours trying to gure this out. So many failed attempts.
Congrats on being the only person to explain the windows install COMPLETELY.
Im going to take you advice nice and give linux a shot.
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

51/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

thanks again.

Jay L

11/08/2013 at 8:41 am

I got as far as the following and cannot get any farther:


Set up useful Python packages
1. setuptools offers the helpful easy_install utility for installing Python packages.
Grab the appropriate version for your system and install.
I successfully installed Python 2.7.5 on a Windows 7 machine, but Im lost by what
you mean by grab the appropriate version [of setuptools and easy_install] for
your system and install. Are these additional packages that I need to download
and install? Once I get these les, how do I run them? Are they installed from the
Command prompt?
Thanks.

Anthony

11/08/2013 at 9:27 am

Jay,
Yes, you must follow the link in the blog post to download and install setuptools.
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

52/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

The instructions for installation are at the link.

Getting started with Python | knowledge thru' sharing

01/07/2014 at 12:35 pm

[] To install python on your system, please follow the instructions on the following link, Its
recommended to install python 2.7 as there are some syntax changes in new python:version
3 which is not backward compatible. http://www.anthonydebarros.com/2011/10/15/settingup-python-in-windows-7/ []

Maz

04/04/2014 at 3:12 pm

dear Anthony
thanks for make everything easy with python .. i have problem i followed all
downland steeps but still cant nd this area
C:\Python27;C:\Python27\Lib\site-packages\;C:\Python27\Scripts\;
where i can add (Scripts\;)

Tony

04/07/2014 at 10:07 am

This was an excellent tutorial. Thank you very much.

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

53/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Python: Setting up in Windows 7 | nasrulhazim.m

05/01/2014 at 3:09 am

[] http://www.anthonydebarros.com/2011/10/15/setting-up-python-in-windows-7/ []

LoopTools: Flask Microframework | Blog - Quadloops Technologies

06/04/2014 at 7:45 am

[] version, as ask has not yet been ported to python 3. Here is a nice and simple guide to
do that, here( Thanks to Anthony DeBarros for the guide. You can follow []

John

06/05/2014 at 2:42 am

Thanks for this, I was constantly running in to problems getting pycrypto


installed (more people have this), seems the solution was installing the x86
version

Force

06/10/2014 at 10:58 pm

Awesome , thank you very much and it is very helpful .


Keep up the good work.

Shane O Neill

07/04/2014 at 3:20 pm

Youre a lifesaver. I had been banging my head against a brick wall for hours
trying to pip install oauth2 on Windows 8; searched all over the place and
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

54/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

couldnt nd instructions that worked until I came to this page, and then it was
sorted in 5 minutes.

Peter

07/21/2014 at 4:18 am

Hi Anthony, Im afraid I nd your step three instructions somewhat confusing.


3. Next, set the systems PATH variable to include directories that include Python
components and packages well add later. To do this:
Right-click Computer and select Properties.
In the dialog box, select Advanced System Settings.
In the next dialog, select Environment Variables.
In the User Variables section, edit the PATH statement to include this:
The Systems PATH variable (on my Win7 system anyway) is a System Variable not
a user variable. So what do I do? Create a User Path vatiable or edit the system
path one. Given the PATH already has content do I just add it on the end with a
comma or delete what is there?

Anthony

07/24/2014 at 12:15 am

Peter,
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

55/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

You can edit the System PATH. Add the Python paths at the end, after a semicolon.

Dinesh

08/03/2014 at 3:55 am

Hi Anthony I am using python 3.7 in windows 8 machine when I executing


program
compiler showing error
Traceback (most recent call last):
File C:/Python34/1.py, line 2, in
import curses
File C:\Python34\lib\curses\__init__.py, line 13, in
from _curses import *
ImportError: No module named _curses
please help!!

bus7dz

10/07/2014 at 3:54 pm

thx great tutorial!

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

56/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

silver

01/01/2015 at 11:55 am

more easy way to install pythonfollow the link


http://s4silver.blogspot.in/p/how-to-install-python.html

Antonio Marcos

01/31/2015 at 10:57 pm

Congratulations!
I could only con gure easy_install with this post.
Thank U !!

shrey mishra

02/16/2015 at 1:38 am

Hi Anthony,
I am trying to install pywin32.exe as i need to use autoit library in robot
framework.
But as i click the setup it shows directory invalid could not create temporary le.
How to x this.

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

57/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Andreas

06/01/2015 at 4:47 am

Hi Anthony,
Best tutorial on the topic that Ive read so far!
Many thanks!

Anthony

06/01/2015 at 7:17 am

Many thanks!

Abhinav Raj

06/03/2015 at 3:49 am

We are using a 32 bit version on a 64 bit environment wont it cause any trouble
such as incompatibility or slowing down of system.

Eugene

07/25/2015 at 5:38 pm

Hello, Anthony!) Many Thanks for your gide! Only one thing, I cant install Python
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

58/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

on my computer with Win7! Error: there is not DLL for install But after
online installation version 3.5 I cant to run IDLE( Python runs normaly)
Help me please!)

Robert

08/10/2015 at 2:23 pm

Excellent step by step instructions to install Python, Easy_Install and PIP


I initially received failure messages when I tried to install Mechanize and
Beautiful Soup. However, because your instructions were so clear I was able to
quickly rule out an issue with your instructions. I switched over to a different
network connection and was able to successfully complete the installations.
(There was a rewall rule blocking access on the rst network connection.)
I also ran into the the issue with my path statement in Windows 7 being a part of
the system variables as opposed to the user variables. Not sure if you can edit
your original post, but it would save some time in scrolling through the
comments, or doing a separate Google search for some readers.
Thank you for taking the time to publish this
Robert

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

59/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Ranjith

09/16/2015 at 2:29 am

i am a linux engineer , my rm developed one django application for managing


inventory,sales and purchase in small shops. we have installed it on one client
system (in windows 7)
we are using python 2.7 with django frame work 1.5 while printing receipts with
the application .we are getting the error 31, ShellExecute, A device attached to
the system is not functioning can you help me in resoving this issues
we are using the following code
=============================================================

importtempfile
importwin32api
importwin32print
importos

fillpath=os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)),"..",
filename=fillpath+'\\sales_pdf.pdf'
printfillpath
print"**************"
win32api.ShellExecute(
0,
"print",
filename,

'/d:"%s"'%win32print.GetDefaultPrinter(),
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

60/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

".",
0
)

in the same system we have taken a print out side of the application with a
python script , that we are able to take print successfully
the python script we have used out side of the application is given below
============================================================

importtempfile
importwin32api
importwin32print
importos

filename="\Document.rtf"
win32api.ShellExecute(
0,
"print",
filename,

'/d:"%s"'%win32print.GetDefaultPrinter(),
".",

)
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

61/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

kindly guide me in resolving the issue


thanks in advance
Ranjith

munaraliyan

10/06/2015 at 6:02 am

I am getting the following error.. what could be the problem.. i am behind a proxy
server.

D:\XX\XXX\pywin32219>pipinstallmechanize
Collectingmechanize

Retrying(Retry(total=4,connect=None,read=None,redirect=None))afterconnectionbrok
/simple/mechanize/

Python Version = 2.7.10

Tutorial Links |

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

10/08/2015 at 2:05 am

62/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

[] http://www.anthonydebarros.com/2011/10/15/setting-up-python-in-windows-7/ []

Hanseatik

11/27/2015 at 11:40 am

IDLE does not start for python 3.5 64bit on windows 7.


I installed Python 3.5 after I uninstalled python2.7 and restarted and every things
seems to be ne. But when I click on IDLE it does not start and gives no error.

Francesco

02/17/2016 at 5:39 am

I would not suggest to install packages that the user could never use. You should
update this guide adding instructions on virtualenv, that is painful to manage in
Windows, but as a quick start install guide 5/5!

Joe Senter

02/25/2016 at 9:01 pm

Great article. Excellent Article.

Automatic Monitor Color Temperature Adjustment - Robu.in

05/25/2016 at 7:03 am

[] you might need to add python to your path to be able to run scripts from the command
http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

63/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

line.This blog post has a simple set of instructions to add python to your []
Leave a Reply

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

Name *
Email *
Website

Post Comment

Notify me of follow-up comments by email.


Notify me of new posts by email.

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

64/65

8/3/2016

AnthonyDeBarros::SettingupPythoninWindows7

Copyright 2009-2016 Anthony DeBarros


I'm hacking on the LESS theme by Jared Erickson. Hosting is by WebFaction.

http://www.anthonydebarros.com/2011/10/15/settinguppythoninwindows7/

65/65