sh create_python_env.sh

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh create_python_env.sh相关的知识,希望对你有一定的参考价值。

#!/bin/bash

# This script is based on
# https://medium.com/welcome-to-the-django/guia-definitivo-para-organizar-meu-ambiente-python-a16e2479b753

PYTHON2_VERSION='2.7.12'
PYTHON3_VERSION='3.5.2'

sudo apt-get install -y git python-pip make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev
sudo pip install virtualenvwrapper

git clone https://github.com/yyuu/pyenv.git ~/.pyenv
git clone https://github.com/yyuu/pyenv-virtualenvwrapper.git ~/.pyenv/plugins/pyenv-virtualenvwrapper

mkdir -p ~/.ve
mkdir -p ~/workspacepy

echo 'export WORKON_HOME=~/.ve' >> ~/.bashrc
echo 'export PROJECT_HOME=~/workspace' >> ~/.bashrc
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
# echo 'pyenv virtualenvwrapper' >> ~/.bashrc

exec $SHELL

pyenv install $PYTHON2_VERSION
pyenv install $PYTHON3_VERSION

pyenv virtualenv $PYTHON3_VERSION jupyter3
pyenv virtualenv $PYTHON3_VERSION tools3

pyenv virtualenv $PYTHON2_VERSION ipython2
pyenv virtualenv $PYTHON2_VERSION tools2

pyenv activate jupyter3
pip install jupyter
# python -m ipykernel install --user
pyenv deactivate

# pyenv activate tools3
# pip install youtube-dl gnucash-to-beancount rows 
# pyenv deactivate

pyenv activate ipython2
pip install ipykernel
# python -m ipykernel install --user
pyenv deactivate

pyenv activate tools2
pip install fabric
pyenv deactivate

# set the path order
pyenv global $PYTHON3_VERSION $PYTHON2_VERSION jupyter3 ipython2 tools3 tools2

# checking
pyenv which python
pyenv which python2
pyenv which jupyter
pyenv which ipython
pyenv which ipython2
pyenv which fabric

# usage samples:

# mkproject newproject_py3
# workon newproject_py3

# mkvirtualenv -a ~/workspace/existing_py2 -p python2 existing_py2

以上是关于sh create_python_env.sh的主要内容,如果未能解决你的问题,请参考以下文章

如何使我的命令行在具有扩展名(.sh)和名称如“weird.sh.sh.sh”的文件上工作

sh sh_template.sh

sh sh.sh

Linux下面如何运行 SH文件

配置告警系统主脚本main.sh mon.sh load.sh 502.sh disk.sh

shell 脚本各种执行方式(source ./*.sh, . ./*.sh, ./*.sh)的区别