How do I run python on my Vagrant vm instance that is CoreOS? I would like to access the python interpreter. Thanks!
You can also install python
on CoreOS using the below script, let's call it install_python.sh
:
#!/bin/bash -e
PYPY_VERSION=5.10.1
wget -O - https://bitbucket.org/pypy/pypy/downloads/pypy3-v$PYPY_VERSION-linux64.tar.bz2 |tar -xjf -
mv -n pypy3-v$PYPY_VERSION-linux64 pypy
## library fixup
mkdir -p pypy/lib
if [[ -f /lib64/libncurses.so.5.9 ]]; then
libncurses_version=5.9
else
libncurses_version=6
fi
ln -snf /lib64/libncurses.so.$libncurses_version $HOME/pypy/lib/libtinfo.so.5
mkdir -p $HOME/bin
cat > $HOME/bin/python <<EOF
#!/bin/bash
LD_LIBRARY_PATH=$HOME/pypy/lib:$LD_LIBRARY_PATH exec $HOME/pypy/bin/pypy3 "\$@"
EOF
chmod +x $HOME/bin/python
$HOME/bin/python --version
You can add it as a provision script to your Vagrantfile
:
Vagrant.configure("2") do |config|
config.vm.provision "shell", path: "install_python.sh"
end
install python for core
user or root
user and use python interpreter using /home/core/bin/python
for example:
$ /home/core/bin/python --version
Python 3.5.3 (3f6eaa010fce, Jan 11 2018, 04:44:35)
[PyPy 5.10.1 with GCC 6.2.0 20160901]
$ /home/core/bin/python
Python 3.5.3 (3f6eaa010fce, Jan 11 2018, 04:44:35)
[PyPy 5.10.1 with GCC 6.2.0 20160901] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>>
Applications and dependencies such as python run in containers on CoreOS. There are many pre-built python containers, such as: https://quay.io/repository/freshbooks/python