清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
Option Explicit Dim pSysEnv Dim objFSO Set pSysEnv = CreateObject("WScript.Shell").Environment("System") Set objFSO=CreateObject("Scripting.FileSystemObject") Function IsMatch(Str, Patrn) Dim r Set r = new RegExp r.Pattern = Patrn IsMatch = r.test(Str) Set r = Nothing End Function Sub SetEnv(pPath, pValue) Dim ExistValueOfPath IF pValue <> "" Then ExistValueOfPath = pSysEnv(pPath) IF Right(pValue, 1) = "\" Then pValue = Left(pValue, Len(pValue)-1) If IsMatch(ExistValueOfPath, "\*?" & Replace(pValue, "\", "\\") & "\\?(\b|;)") Then Exit Sub If ExistValueOfPath <> "" Then pValue = ";" & pValue pSysEnv(pPath) = ExistValueOfPath & pValue Else pSysEnv.Remove(pPath) End IF End Sub Sub WriteEnv(pPath, pValue) pSysEnv(pPath) = pValue End Sub WriteEnv "PYTHONHOME", objFSO.GetFolder(".").Path WriteEnv "PYTHONPATH", objFSO.GetFolder(".").Path SetEnv "Path", objFSO.GetFolder(".").Path Set pSysEnv = Nothing Dim oShell Set oShell = WScript.CreateObject("WScript.Shell") oShell.Exec objFSO.GetFolder(".").Path & "\Lib\site-packages\pythonwin\Pythonwin.exe" Set oShell = Nothing