top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to configure Python 2.7 on Windows 7?

+3 votes
669 views

I'm new to Python. I downloaded the 64-bit build of Python 2.7.10 from www.python.org/downloads/release/python-2710. I run Windows 7 Pro on a Dell PC.

I find that the installation package creates a folder called "Python 2.7" in my Start menu, with both a command prompt and IDLE GUI options.

I hold my scripts in another directory that is parallel to but not under the one where Python 2.7 resides, so I set the Environment Variable PYTHONPATH to include the directory where my scripts reside. Unfortunately, I am unable to reach them in either the IDLE GUI or the "Python command line" in that folder in my start menu. The only way I have managed to run Python scripts is to open an ordinary command prompt from Accessories, navigate to the directory with the scripts, and run python from the command prompt in that directory.

Can anyone let me know what I'm not doing that I should be doing to run Python and my scripts from the parallel directory under the GUI or the command line from the start menu folder ?

posted Sep 20, 2015 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

1) PYTHONPATH is used to specify where the Python interpreter will look for "import" modules from within a running Python script.

2) If the install (I have always used the ActiveState installs so don't know what plain Python does on Windows) has set up the environment such that ".py" files are executable, then putting the script directory on the regular system PATH should let you run them by entering their name in a command shell.

answer Sep 21, 2015 by Sanketi Garg
Similar Questions
+2 votes

I want to install Python on a PC with the 64 bit version of Windows 7. I want Python to be able to use as much as possible of the RAM.

When I install the 64 bit version of Python I find that sys.maxint == 2**31 - 1 Whereas the Pythpon installed on my 64 bit linux system returns sys.maxint == 2**63 - 1.

It looks to me as though 32 and 64 bit versions of Python on 64 bit Windows are both really 32 bit Python, differing only in how they interact with Windows. So I wouldnt expect 64 bit Python running on 64 bit Windows to allow the large data struictures I could have with 64 bit Python running on 64 bit linux.

Is that true?I have spent a couple of hours searching for a definitive description of the difference between the 32 and 64 bit versions of Python for Windows and haven't found anything.

0 votes

I want to install sip on windows bit using python 32 bit.
I download sip from this link https://www.riverbankcomputing.com and I try to install from cmd line :

C:WINDOWSsystem32>cd C:UsersusernameDesktopsip-4.17

C:UsersusernameDesktopsip-4.17>python configure.py install
and take that error any idea ?

This is SIP 4.17 for Python 2.7.11 on win32.
Error: Unsupported macro name specified. Use the --show-build-macros flag to see a list of supported macros.

+2 votes

Manual says "-c Execute the Python code in command. command can be one or more statements separated by newlines, with significant leading whitespace as in normal module code."

In Windows Command Prompt I get:

C:ProgramsPython33>python -c "a=1nprint(a)"
 File "", line 1
 a=1nprint(a)
 ^
SyntaxError: unexpected character after line continuation character
(Same if I remove quotes.)

How do I get this to work?

+1 vote

I understand there have been changes to the way that extensions are supposed to be built for windows. Is there any user documentation regarding these changes?

Last time I looked the appropriate Visual Studio hadn't been release so I guess I will need to use my MSDN skills (or incantations) to first get that installed.

...