为了能够通过简单的双击来安装轮文件,您可以执行以下操作之一:
1)以管理员权限在命令行中运行两条命令:
assoc .whl=pythonwheel
ftype pythonwheel=cmd /c pip.exe install "%1" ^& pause
2) 或者,可以将它们复制到wheel.bat
文件中并使用属性中的“以管理员身份运行”复选框执行。
PS pip.exe 假定在 PATH 中。
更新:
(1) 这些可以组合在一行中:
assoc .whl=pythonwheel& ftype pythonwheel=cmd /c pip.exe install -U "%1" ^& pause
(2) .bat 文件的语法略有不同:
assoc .whl=pythonwheel& ftype pythonwheel=cmd /c pip.exe install -U "%%1" ^& pause
它的输出也可以更详细:
@assoc .whl=pythonwheel|| echo Run me with administrator rights! && pause && exit 1
@ftype pythonwheel=cmd /c pip.exe install -U "%%1" ^& pause || echo Installation error && pause && exit 1
@echo Installation successfull & pause
有关详细信息,请参阅我的博客文章。