It's a type of Planche
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

install_python_versions.sh 2.4KB

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