How to install python 3.2.3 on Windows 7 enterpris

2019-08-29 18:41发布

问题:

although I have been using python a long time very easily in a Linux environment, I have tremendous trouble to even install it correctly in a windows environment. I hope this is a question to be asked here, as it is not directly a programming question. Especially, I have the following problems:

  • When on the command line, python is not a recognized command. Do I have to set the Windows path manually myself? If so, how to do that?

  • When starting a python script, should this be done with python.exe or pythonw.exe? What is the difference?

  • I also tried to install ipython several times, it never got installed (even after following the starting ipythonenter link description here thread.

  • When starting a script with python.exe, a window pops up and closes immediately. I saw some hints in putting in a readline command, which is of no help if there is a syntax error in the script. So how to be able to keep the window open, or how to run the command on the cmd.exe?

Thank you for any help on these items.

Alex

回答1:

1) Look here: www.computerhope.com/issues/ch000549.htm

2) It has already been answered, always try to use search before asking question: pythonw.exe or python.exe?

4) When using cmd.exe just navigate to your script folder using dir for changing directories and C:,D:,etc. for changing drives. Then run script by typing just the script name. When installed correctly, Python automatically launches .py scripts with python, so you don't have to write 'python' before script name. When run in cmd, window will stay open. If you want it to stay open even when launching script with double-click, use function waiting for user input, see here How to keep a Python script output window open?



回答2:

You might want to use Python3.3, there is a new launcher for Python scripts in it. By that, you can start Python scripts with py <scriptname> which has the benefit of being installed in your path (C:\Windows\system32) and you can use a shebang to tell whether the script is for Python2 or Python3. Also

In addition to the launcher, the Windows installer now includes an option to add the newly installed Python to the system PATH (contributed by Brian Curtin in issue 3561).