@@ -324,7 +324,7 @@ py_discover_config <- function(required_module = NULL, use_environment = NULL) {
324
324
325
325
# provide other common locations
326
326
python_versions <- c(python_versions , py_discover_config_fallbacks())
327
-
327
+
328
328
# next add all known virtual environments
329
329
python_versions <- c(python_versions , python_envs $ python )
330
330
@@ -349,14 +349,14 @@ py_discover_config <- function(required_module = NULL, use_environment = NULL) {
349
349
350
350
# get the config
351
351
config <- python_config(python_version , required_module , python_versions )
352
-
352
+
353
353
# if this is a conda python installation, then create an r-reticulate
354
354
# environment and use that instead
355
355
initenv <-
356
356
identical(getOption(" reticulate.conda.autoclone" , FALSE ), TRUE ) &&
357
357
identical(getOption(" reticulate.python.initializing" ), TRUE ) &&
358
358
identical(config $ conda , TRUE )
359
-
359
+
360
360
if (initenv ) {
361
361
fmt <- " * Found conda installation at %s; creating 'r-reticulate' environment ..."
362
362
messagef(fmt , pretty_path(config $ prefix ))
@@ -389,43 +389,43 @@ py_discover_config <- function(required_module = NULL, use_environment = NULL) {
389
389
}
390
390
391
391
py_discover_config_fallbacks <- function () {
392
-
392
+
393
393
# prefer conda python if available
394
394
conda <- find_conda()
395
395
if (! is.null(conda ) && file.exists(conda )) {
396
-
396
+
397
397
pythons <- tryCatch(
398
398
conda_python(envname = " base" , conda = conda , all = TRUE ),
399
399
error = identity
400
400
)
401
-
401
+
402
402
if (is.character(pythons ))
403
403
return (pythons )
404
-
404
+
405
405
}
406
-
406
+
407
407
# on Windows, try looking in the registry
408
408
if (is_windows())
409
409
return (py_versions_windows()$ executable_path )
410
-
410
+
411
411
# otherwise, just search some default locations
412
412
prefixes <- c(
413
413
" /opt/local/python" ,
414
414
" /opt/python" ,
415
415
" /usr/local" ,
416
416
" /usr"
417
417
)
418
-
418
+
419
419
suffixes <- c(" bin/python3" , " bin/python" )
420
420
grid <- expand.grid(
421
421
prefix = prefixes ,
422
422
suffix = suffixes ,
423
423
KEEP.OUT.ATTRS = FALSE ,
424
424
stringsAsFactors = FALSE
425
425
)
426
-
426
+
427
427
paste(grid $ prefix , grid $ suffix , sep = " /" )
428
-
428
+
429
429
}
430
430
431
431
@@ -1016,7 +1016,7 @@ read_python_versions_from_registry <- function(hive, key,type=key) {
1016
1016
arch <- NA
1017
1017
}
1018
1018
} else { # type == "PythonCore"
1019
- matches <- regexec(" ^(\\ d)\\ .(\\ d)(?:-(32|64))?$" , version )
1019
+ matches <- regexec(" ^(\\ d+ )\\ .(\\ d+ )(?:-(32|64))?$" , version )
1020
1020
matches <- regmatches(version , matches )[[1 ]]
1021
1021
if (length(matches ) == 4 ) {
1022
1022
version <- paste(matches [[2 ]], matches [[3 ]], sep = " ." )
0 commit comments