-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFix Python.ahk
More file actions
44 lines (33 loc) · 972 Bytes
/
Fix Python.ahk
File metadata and controls
44 lines (33 loc) · 972 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#Requires AutoHotkey v2.0
if not FileExist("python.exe")
ExitApp
; Step 0. Download the embedded zip from:
; https://www.python.org/downloads/windows/
; Step 1.
Download('https://bootstrap.pypa.io/get-pip.py', 'get-pip.py')
; Step 2.
Run('python.exe get-pip.py')
; This will create the Lib and Scripts folders.
; Step 3.
; Uncomment the import site.
Loop Files, "python*._pth" {
Text := FileRead(A_LoopFilePath)
Text := StrReplace(Text, "#import site", "import site")
FileDelete A_LoopFilePath
while FileExist(A_LoopFilePath)
Sleep 10
FileAppend(Text, A_LoopFilePath, "`n")
}
; Step 4.
; Create the pip cmd shortcut.
if FileExist("pip.cmd")
FileDelete("pip.cmd")
FileAppend("
(
@echo off
%~dp0Scripts\pip.exe %*
)", "pip.cmd", "`n")
if FileExist("python.exe")
try FileDelete(A_ScriptFullPath)
catch
MsgBox("Can't self-delete, so delete me manually once everything is done")