I am trying to install pyenv
on my vagrant vm.
My Vagrantfile
looks like this:
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/focal64"
config.vm.box_version = "20220517.0.0"
config.vm.provision :shell, path: "./provision/install-pyenv.sh", privileged: false
config.vm.provision :shell, path: "./provision/install-python.sh", privileged: false
end
Where ./provision/install-pyenv.sh
is:
#!/usr/bin/env bash
# Install required dependencies
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl
# Run the installer
curl https://pyenv.run | bash
# Add the required variables to the ~/.bashrc file
echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
source ~/.bashrc
And ./provision/install-python.sh
is:
#!/usr/bin/env bash
# Install the required Python version
pyenv install -v 3.10.4
# Set the global python version
pyenv global 3.10.4
But when I run vagrant up
- I get the following error:
pyenv
is not a recognised command.
What am I doing wrong? Am I adding the env vars to the incorrect ~/.bashrc?
I don't really understand where I'm going wrong with this.