Browse Source

Make install pyenv script into python script

fix-instructions
Charles Reid 7 years ago
parent
commit
867260ca03
  1. 20
      scripts/install_pyenv.py
  2. 17
      scripts/install_pyenv.sh

20
scripts/install_pyenv.py

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
#!/usr/bin/python3
import getpass
import tempfile
import subprocess
def install_pyenv():
user = getpass.getuser()
if(user=="root"):
raise Exception("You are root - you should run this script as a normal user.")
else:
# Install pyenv
pyenvcmd = ["curl","-L","https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer","|","/bin/bash"]
subprocess.call(pyenvcmd, shell=True)
# We don't need to add ~/.pyenv/bin to $PATH,
# it is already done.
if __name__=="__main__":
install_pyenv()

17
scripts/install_pyenv.sh

@ -1,17 +0,0 @@ @@ -1,17 +0,0 @@
#!/bin/bash
if [ "$(id -u)" == "0" ]; then
echo ""
echo ""
echo "This script should be run as a normal user."
echo ""
echo ""
exit 1;
fi
# Install pyenv
curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
## This should already be in ~/.bash_profile
#echo 'export PATH="~/.pyenv/bin:$PATH"' >> ~/.bash_profile
Loading…
Cancel
Save