Last active
January 17, 2022 14:27
-
-
Save Luocy7/1170141ac4d510194e6b4106762af1cd to your computer and use it in GitHub Desktop.
pyenv init for wsl ubuntu20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
pyenv_home=$HOME/.pyenv | |
pyenv_cache=$pyenv_home/cache | |
pip_folder=$HOME/.pip | |
pip_file=$pip_folder/pip.conf | |
if [ ! -d "$pyenv_home" ]; then | |
git clone https://github.com/pyenv/pyenv.git "$pyenv_home" | |
git clone https://github.com/pyenv/pyenv-virtualenv.git "$pyenv_home"/plugins/pyenv-virtualenv | |
cat <<'EOF' >>~/.zshrc | |
# pyenv config | |
export PYENV_ROOT="$HOME/.pyenv" | |
export PATH="$PYENV_ROOT/bin:$PATH" | |
if command -v pyenv 1>/dev/null 2>&1; then | |
eval "$(pyenv init -)" | |
eval "$(pyenv virtualenv-init -)" | |
fi | |
EOF | |
fi | |
if [ ! -d "$pyenv_cache" ]; then | |
mkdir "$pyenv_cache" | |
fi | |
# wget https://npm.taobao.org/mirrors/python/3.6.12/Python-3.6.12.tar.xz -P "$pyenv_cache" | |
# wget https://npm.taobao.org/mirrors/python/3.7.9/Python-3.7.9.tar.xz -P "$pyenv_cache" | |
# wget https://npm.taobao.org/mirrors/python/3.8.6/Python-3.8.6.tar.xz -P "$pyenv_cache" | |
# wget https://npm.taobao.org/mirrors/python/3.9.0/Python-3.9.0.tar.xz -P "$pyenv_cache" | |
if [ ! -d "$pip_folder" ]; then | |
mkdir "$pip_folder" | |
fi | |
cat <<EOF >>"$pip_file" | |
[global] | |
timeout = 120 | |
index-url = https://mirrors.aliyun.com/pypi/simple | |
trusted-host = mirrors.aliyun.com | |
EOF | |
echo "add pip to file" | |
echo "before install please visit\nhttps://github.com/pyenv/pyenv/wiki#suggested-build-environment" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment