Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
bb0cf125
Commit
bb0cf125
authored
1 year ago
by
AlQuemist
Browse files
Options
Downloads
Patches
Plain Diff
Doc: add pyenv documentation
parent
455ec262
No related branches found
No related tags found
1 merge request
!2061
Add pyenv documentation to Developer's Corner
Pipeline
#117867
passed
1 year ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hugo/content/dev/pyenv.md
+100
-0
100 additions, 0 deletions
hugo/content/dev/pyenv.md
with
100 additions
and
0 deletions
hugo/content/dev/pyenv.md
0 → 100644
+
100
−
0
View file @
bb0cf125
+++
title = "Pyenv"
weight = 80
+++
[
Pyenv
](
https://github.com/pyenv/pyenv
)
is a platform to install and manage
different versions of Python, isolated from the default Python version.
Its advantage compared to the other options, like Anaconda, is its simplicity and smallness.
Currently, to build BornAgain libraries for different versions of Python,
we use the
`pyenv`
platform.
# Installing `pyenv` platform
#### Linux
Obtain the installer from
<https://github.com/pyenv/pyenv-installer>
.
To install
`pyenv`
, use
```
curl https://pyenv.run | bash
```
By default,
`pyenv`
is installed in
`$HOME/.pyenv`
.
The dependencies must be installed before building Python;
see
<https://github.com/pyenv/pyenv/wiki#suggested-build-environment>
:
```
sudo apt install build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev curl \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
```
#### MacOS
Install
`pyenv`
via
`homebrew`
:
```
brew install pyenv
```
The rest of the
`pyenv`
instructions are like those for Linux.
#### Windows
On MS-Windows,
[
pyenv-win
](
https://github.com/pyenv-win
)
should be used.
The available Python versions are distributed as _binary_, therefore
one must choose the version from a given list.
The Python environments are installed by default under
`%USERPROFILE%\.pyenv\pyenv-win\versions`
.
To obtain the
`pyenv`
root, enter the following in
`cmd`
:
```
echo %PYENV_ROOT%
```
#### Using `pyenv`
**Obtain a list of available Python versions**
```
pyenv install --list
```
**Obtain a list of available Python versions**
```
pyenv install --list
```
**Install a Python version**
To install a certain version, say 3.10, use:
```
pyenv install 3.10
```
**List installed versions**
```
pyenv versions
```
**Obtain the `pyenv` root folder where all versions are stored**
```
pyenv root
```
**Obtain the path to the current version of Python in pyenv**
```
pyenv which python3
```
**Install Python packages for a certain version of Python**
If the path to the Python executable is, for instance,
`$HOME/.pyenv/versions/3.10.12/bin/python3`
,
then to install
`numpy`
for this specific Python version, one should use
```
$HOME/.pyenv/versions/3.10.12/bin/python3 -m pip install numpy
```
#### Build BornAgain with a specific Python version
To build BornAgain with a specific Python version, the path to the Python platform should be included in
`CMAKE_PREFIX_PATH`
variable;
for instance, if Python 3.10.12 is installed in
`$HOME/.pyenv/versions/3.10.12`
folder, then
`CMAKE_PREFIX_PATH`
should include this path.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment