@@ -135,8 +135,6 @@ export async function useCpythonVersion(
135
135
136
136
if ( IS_WINDOWS ) {
137
137
// Add --user directory
138
- // `installDir` from tool cache should look like $RUNNER_TOOL_CACHE/Python/<semantic version>/x64/
139
- // So if `findLocalTool` succeeded above, we must have a conformant `installDir`
140
138
const version = path . basename ( path . dirname ( installDir ) ) ;
141
139
const major = semver . major ( version ) ;
142
140
const minor = semver . minor ( version ) ;
@@ -145,8 +143,8 @@ export async function useCpythonVersion(
145
143
architecture === 'x86' &&
146
144
( major > 3 || ( major === 3 && minor >= 10 ) )
147
145
) {
148
- // For Python >= 3.10 and architecture= 'x86', add the architecture-specific folder to the path
149
- const arch = '32' ;
146
+ // For Python >= 3.10 and architecture='x86', add the architecture-specific folder to the path
147
+ const arch = '32' ; // Only for x86 architecture
150
148
151
149
const userScriptsDir = path . join (
152
150
process . env [ 'APPDATA' ] || '' ,
@@ -156,16 +154,24 @@ export async function useCpythonVersion(
156
154
) ;
157
155
core . addPath ( userScriptsDir ) ;
158
156
} else {
157
+ // For Python >= 3.10 and architecture 'x64', or other versions, use the default user path
159
158
const userScriptsDir = path . join (
160
159
process . env [ 'APPDATA' ] || '' ,
161
160
'Python' ,
162
161
`Python${ major } ${ minor } ` ,
163
162
'Scripts'
164
163
) ;
165
-
166
- // Add the default path to the environment PATH variable
167
164
core . addPath ( userScriptsDir ) ;
168
165
}
166
+
167
+ // Dynamically handle case for Python314t
168
+ const pythonPath = path . join (
169
+ process . env [ 'APPDATA' ] || '' ,
170
+ 'Python' ,
171
+ `Python${ major } ${ minor } t` ,
172
+ 'Scripts'
173
+ ) ;
174
+ core . addPath ( pythonPath ) ;
169
175
}
170
176
// On Linux and macOS, pip will create the --user directory and add it to PATH as needed.
171
177
}
0 commit comments