File: install_python.Rd

package info (click to toggle)
r-cran-reticulate 1.41.0.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,088 kB
  • sloc: cpp: 5,154; python: 620; sh: 13; makefile: 2
file content (66 lines) | stat: -rw-r--r-- 2,413 bytes parent folder | download
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/install-python.R
\name{install_python}
\alias{install_python}
\title{Install Python}
\usage{
install_python(
  version = "3.10:latest",
  list = FALSE,
  force = FALSE,
  optimized = TRUE
)
}
\arguments{
\item{version}{The version of Python to install.}

\item{list}{Boolean; if set, list the set of available Python versions?}

\item{force}{Boolean; force re-installation even if the requested version
of Python is already installed?}

\item{optimized}{Boolean; if \code{TRUE}, installation will take significantly longer but
should result in a faster Python interpreter. Only applicable on macOS and Linux.}
}
\description{
Download and install Python, using the \href{https://github.com/pyenv/pyenv}{pyenv}.
and \href{https://github.com/pyenv-win/pyenv-win}{pyenv-win} projects.
}
\details{
In general, it is recommended that Python virtual environments are created
using the copies of Python installed by \code{\link[=install_python]{install_python()}}. For example:

\if{html}{\out{<div class="sourceCode">}}\preformatted{library(reticulate)
version <- "3.9.12"
install_python(version)
virtualenv_create("my-environment", version = version)
use_virtualenv("my-environment")

# There is also support for a ":latest" suffix to select the latest patch release
install_python("3.9:latest") # install latest patch available at python.org

# select the latest 3.9.* patch installed locally
virtualenv_create("my-environment", version = "3.9:latest")
}\if{html}{\out{</div>}}
}
\note{
On macOS and Linux this will build Python from sources, which may
take a few minutes. Installation will be faster if some build
dependencies are preinstalled. See
\url{https://github.com/pyenv/pyenv/wiki#suggested-build-environment} for
example commands you can run to pre-install system dependencies
(requires administrator privileges).

If \code{optimized = TRUE}, (the default) Python is build with:

\if{html}{\out{<div class="sourceCode">}}\preformatted{PYTHON_CONFIGURE_OPTS="--enable-shared --enable-optimizations --with-lto"
PYTHON_CFLAGS="-march=native -mtune=native"
}\if{html}{\out{</div>}}

If \code{optimized = FALSE}, Python is built with:

\if{html}{\out{<div class="sourceCode">}}\preformatted{PYTHON_CONFIGURE_OPTS=--enable-shared
}\if{html}{\out{</div>}}

On Windows, prebuilt installers from \url{https://www.python.org} are used.
}