手动安装

cd ~
git clone git://github.com/yyuu/pyenv.git .pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
source ~/.bashrc

 

使用pyenv安装python环境

git clone git://github.com/yyuu/pyenv.git pyenv
PYENV_ROOT="$(pwd)/pyenv"
export PYENV_ROOT
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
pyenv local 3.6.3 ||env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.6.3 && pyenv local 3.6.3  #(PYTHON_CONFIGURE_OPTS="--enable-shared"加上以生成动态链接库)
pip3 install --upgrade pip setuptools wheel --index-url http://pypi.douban.com/simple –-trusted-host pypi.douban.com 
pip3 install -r requirements.txt --index-url http://pypi.douban.com/simple –-trusted-host pypi.douban.com
pip3 install virtualenv
if [ ! -f venv/bin/activate ]; then
    virtualenv -p "$(pwd)/pyenv/versions/3.6.3/bin/python" venv
fi
cat > venv/pip.conf <<EOF
[global]
index-url = http://pypi.douban.com/simple/

[install]
index-url = http://pypi.douban.com/simple/
extra-index-url = http://pypi.douban.com/simple/
trusted-host = pypi.douban.com
EOF

  

cat requirements.txt

# http client
requests==2.18.4

 

参考文章:

使用 pyenv 管理 Python 版本

相关文章:

  • 2021-08-27
  • 2021-07-31
  • 2021-11-27
  • 2022-12-23
  • 2022-12-23
  • 2021-06-29
  • 2021-09-15
猜你喜欢
  • 2021-07-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-03
  • 2022-12-23
相关资源
相似解决方案