@@ -146,32 +146,50 @@ export async function useCpythonVersion(
146
146
// For Python >= 3.10 and architecture='x86', add the architecture-specific folder to the path
147
147
const arch = '32' ; // Only for x86 architecture
148
148
149
- const userScriptsDir = path . join (
149
+ const pythonPath = path . join (
150
150
process . env [ 'APPDATA' ] || '' ,
151
151
'Python' ,
152
152
`Python${ major } ${ minor } -${ arch } ` ,
153
153
'Scripts'
154
154
) ;
155
- core . addPath ( userScriptsDir ) ;
155
+ core . addPath ( pythonPath ) ;
156
156
} else {
157
157
// For Python >= 3.10 and architecture 'x64', or other versions, use the default user path
158
- const userScriptsDir = path . join (
158
+ const pythonPath = path . join (
159
159
process . env [ 'APPDATA' ] || '' ,
160
160
'Python' ,
161
161
`Python${ major } ${ minor } ` ,
162
162
'Scripts'
163
163
) ;
164
- core . addPath ( userScriptsDir ) ;
164
+ core . addPath ( pythonPath ) ;
165
165
}
166
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 ) ;
167
+ if (
168
+ architecture === 'x86' &&
169
+ ( major > 3 || ( major === 3 && minor >= 10 ) )
170
+ ) {
171
+ // For Python >= 3.10 and architecture='x86', add the architecture-specific folder to the path
172
+ const arch = '32' ; // Only for x86 architecture
173
+
174
+ // Dynamically handle case for Python314t
175
+ const pythonPath = path . join (
176
+ process . env [ 'APPDATA' ] || '' ,
177
+ 'Python' ,
178
+ `Python${ major } ${ minor } t--${ arch } ` ,
179
+ 'Scripts'
180
+ ) ;
181
+ core . addPath ( pythonPath ) ;
182
+ } else {
183
+ // For Python >= 3.10 and architecture 'x64', or other versions, use the default user path
184
+ // Dynamically handle case for Python314t
185
+ const pythonPath = path . join (
186
+ process . env [ 'APPDATA' ] || '' ,
187
+ 'Python' ,
188
+ `Python${ major } ${ minor } t` ,
189
+ 'Scripts'
190
+ ) ;
191
+ core . addPath ( pythonPath ) ;
192
+ }
175
193
}
176
194
// On Linux and macOS, pip will create the --user directory and add it to PATH as needed.
177
195
}
0 commit comments