如何使用特定的`python.exe`来执行.py?

时间:2015-06-02 09:12:47

标签: python windows cmd executable file-association

我在Control Panel\Programs\Default Programs\Set Associationsassoc / ftype中尝试过,但是Windows一直使用错误的python.exeC:\Python27\)而不是我想要的那个(C:\Users\nlab\Downloads\WinPython-64bit-2.7.9.5\python-2.7.9.amd64\

>where python
C:\Users\nlab\Downloads\WinPython-64bit-2.7.9.5\python-2.7.9.amd64\python.exe
C:\Python27\python.exe
C:\Program Files (x86)\LilyPond\usr\bin\python.exe

>assoc .py
.py=Python.File.WinPython

>ftype Python.File.WinPython
Python.File.WinPython=C:\Users\nlab\Downloads\WinPython-64bit-2.7.9.5\python-2.7
.9.amd64\python.exe "%1" %*

>set PATH
Path=C:\Users\nlab\Downloads\WinPython-64bit-2.7.9.5\python-2.7.9.amd64;...C:\Python27;C:\Python27\Scripts;...C:\Program Files (x86)\LilyPond\usr\bin;...
PATHEXT=.PY;...

我刚刚编造Python.File.WinPython,是允许的吗?

1 个答案:

答案 0 :(得分:0)

https://github.com/winpython/winpython/wiki/Installation#Registration

(但如果你这样做,你将失去你的python2.7注册)

另一个解决方案是:

call C:\Users\nlab\Downloads\WinPython-64bit-2.7.9.5\scripts\env.bat
python my_progam_.py