Can I copy a Python interpreter and rename it without ill effect?
Because of some asinine problem I'm having with multiple Python interpreters and Windows 7, could I simply copy an interpreter, rename it, and run scripts with it witho开发者_Python百科ut any problems?
My Python 2.6 install came with a python.exe
and python26.exe
which are identical according to fc
. It seems a convenient arrangement to unambiguously pick a Python version when multiple can be found on the PATH
envvar, but for some reason those version-tagged python.exe
's weren't included in the default 2.7 MSI installer.
Yes, depending on what you are doing. You should also be able to move a whole installed interpreter (i.e. the libs and everything) but moving just the executable will probably cause you problems.
You might want to create a .bat file that you can use in place of your script that selects the correct interpreter. In that case you can even do things like pick a virtualenv instance.
c:\python26\python.exe c:\tools\myscript.py %*
精彩评论