手动安装
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
参考文章: