It's a type of Planche
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

install_python_versions.sh 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #!/usr/bin/env bash
  2. declare -a py_versions=( \
  3. "3" \
  4. "3.5" \
  5. "3.6" \
  6. "3.7" \
  7. "3.8" \
  8. )
  9. if [ -f /etc/os-release ]; then
  10. source /etc/os-release
  11. fi
  12. if which apt > /dev/null; then
  13. apt update -qq
  14. apt -y install \
  15. make \
  16. build-essential \
  17. libssl-dev \
  18. zlib1g-dev \
  19. libbz2-dev \
  20. libreadline-dev \
  21. libsqlite3-dev \
  22. wget \
  23. curl \
  24. llvm \
  25. libncurses5-dev \
  26. libncursesw5-dev \
  27. xz-utils \
  28. tk-dev \
  29. libffi-dev \
  30. liblzma-dev \
  31. python3-openssl \
  32. git \
  33. graphviz \
  34. libxslt1-dev
  35. fi
  36. if which yum > /dev/null; then
  37. yum -y groupinstall "Development Tools"
  38. yum -y install \
  39. bzip2 \
  40. bzip2-devel \
  41. git \
  42. graphviz \
  43. libffi-devel \
  44. libxslt-devel \
  45. openldap-devel \
  46. openssl-devel \
  47. readline-devel \
  48. sqlite \
  49. sqlite-devel \
  50. xz \
  51. xz-devel \
  52. zlib-devel
  53. fi
  54. if [ ! -d ${HOME}/.pyenv ]; then
  55. git clone https://github.com/pyenv/pyenv.git ${HOME}/.pyenv
  56. fi
  57. cd ${HOME}/.pyenv
  58. git pull
  59. cd ~-
  60. if [ ! -f ${HOME}/.pyenv/bin/get-pip.py ]; then
  61. wget -O ${HOME}/.pyenv/bin/get-pip.py https://bootstrap.pypa.io/get-pip.py
  62. fi
  63. export PYENV_ROOT="${HOME}/.pyenv"
  64. export PATH="${PYENV_ROOT}/bin:${PATH}"
  65. if command -v pyenv 1>/dev/null 2>&1; then eval "$(pyenv init -)"; fi
  66. ${PYENV_ROOT}/plugins/python-build/install.sh
  67. for short_ver in "${py_versions[@]}"; do
  68. echo "Checking Python ${short_ver}";
  69. if [ -z "${short_ver##*.*}" ]; then
  70. export long_ver=$(pyenv install -l | \
  71. grep -Po "(?<=\s)[0-9\.]+$" | \
  72. grep "${short_ver}." | \
  73. tail -n1);
  74. echo "Installing /usr/local/bin/python${short_ver} (${long_ver}) via pyenv."
  75. if [ "${ID}" == "debian" ]; then
  76. CFLAGS=-I/usr/include/openssl LDFLAGS=-L/usr/lib python-build ${long_ver} /usr/local/
  77. else
  78. CFLAGS=-I/usr/include/openssl LDFLAGS=-L/usr/lib64 python-build ${long_ver} /usr/local/
  79. fi
  80. echo "Updating pip, setuptools, and virtualenv in /usr/local/bin/python${short_ver}"
  81. /usr/local/bin/python${short_ver} ${HOME}/.pyenv/bin/get-pip.py
  82. /usr/local/bin/python${short_ver} -m pip install -U pip setuptools virtualenv
  83. else
  84. if [ -f /usr/bin/python${short_ver} ]; then
  85. echo "Updating pip, setuptools, and virtualenv in /usr/bin/python${short_ver}"
  86. /usr/bin/python${short_ver} ${HOME}/.pyenv/bin/get-pip.py
  87. /usr/bin/python${short_ver} -m pip install -U pip setuptools virtualenv
  88. fi
  89. fi
  90. done