简体   繁体   English

我如何让Windows使用特定的`python.exe`执行.py?

[英]how do i get windows to execute .py with specific `python.exe`?

i tried in Control Panel\\Programs\\Default Programs\\Set Associations , and also assoc / ftype , but windows keeps using the wrong python.exe ( C:\\Python27\\ ) instead of the one i want ( C:\\Users\\nlab\\Downloads\\WinPython-64bit-2.7.9.5\\python-2.7.9.amd64\\ ) 我在Control Panel\\Programs\\Default Programs\\Set Associations以及assoc / 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;...

i just made up Python.File.WinPython , is that allowed? 我刚刚组成了Python.File.WinPython ,允许吗?

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

(but you will loose your python2.7 registration if you do that) (但如果这样做,您将失去python2.7注册)

the other solution is : 另一个解决方案是:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在加载时让Git Bash(在Windows上)自动连接到“ winpty python.exe”? - How do I get Git Bash (on Windows) to automatically connect to “winpty python.exe” upon loading? python.exe 在我运行 python **.py 时崩溃,来自 windows ZDFFF0A7FA1A55C8C1A4966C19FDA445 - python.exe was crashed when I run python **.py from windows cmd 我可以用 python.exe 执行.pyw 文件吗? - can I execute .pyw file with python.exe? 如何执行 python.exe 来打开它,就像我从名为“base”的 anaconda 环境中打开它一样? - How can I execute python.exe to open as if I opened it from the anaconda environment named “base”? NetCore 3.1:如何使用 Azure 上的进程执行 python.exe? - NetCore 3.1: How to execute python.exe using Process on Azure? 获取从特定 python.exe 路径运行的 vscode 调试 - get vscode debug running from a specific python.exe path 如何将项目重新路由到 PyCharm 中的另一个 Python 版本? (错误:'C:\Users\...\python.exe' 处没有 Python) - How do I reroute a project to another Python version in PyCharm? (Error: No Python at 'C:\Users\…\python.exe') 如何使用便携式 python.exe 启动 python package? 它不会找到 package - How do I launch a python package using portable python.exe? It won't find the package 如何处理 2 python.exe - How to deal with 2 python.exe 如何从cmd获取python.exe路径? - How to get python.exe path from cmd?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM