Change default Python interpreter on Windows XP

后端 未结 7 1186
无人及你
无人及你 2021-02-01 09:06

I have two python versions: Python 2.5 and Python 2.7. When I\'m setting up django, I want to use Python 2.7, but django is using Python 2.5 somehow.

How can I make sur

相关标签:
7条回答
  • 2021-02-01 09:31

    Changing your PATH will help, if you always call python directly, rather than relying on file association.

    For example: "python foo.py" will run the 'foo' script with whichever python is first on your PATH.

    However, if you just run "foo.py", the handler associated in the registry, for this file extension, will be the first one called.

    In your case, it sounds like that would be python 2.5. Have a look by opening regedit, and checking the values of:

    HKEY_CLASSES_ROOT\Python.File\shell\open\command
    

    The (default) value listed will probably be something like "C:\Python25\python.exe" "%1" %*

    A quick (and dirty?) fix for you would be to change these values to the python version you actually want.

    A better fix would be to do something like what's outlined in this feature request:

    http://bugs.python.org/issue4485

    Since then, as long as you had admin rights, you could switch as you needed by pointing assoc at the version you want quickly.

    0 讨论(0)
提交回复
热议问题