環境:python
操做系統:Ubuntu 16.04
git
# 更新包更新庫 root@miracle-ThinkPad-P50:~# apt-get update # 安裝git root@miracle-ThinkPad-P50:~# apt-get install -y curl git-core # 安裝 pyenv root@miracle-ThinkPad-P50:~# curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
# 更新pyenv路徑 root@miracle-ThinkPad-P50:~# echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile root@miracle-ThinkPad-P50:~# echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile root@miracle-ThinkPad-P50:~# echo 'eval "$(pyenv init -)"' >> ~/.bash_profile # 使配置生效 root@miracle-ThinkPad-P50:~# source ~/.bash_profile # 查詢 pyenv 已安裝的版本。表示pyenv已經安裝完成 root@miracle-ThinkPad-P50:~# pyenv versions * system (set by /root/.pyenv/version)
# 安裝依賴 root@miracle-ThinkPad-P50:~# apt-get install -y libssl-dev libbz2-dev libreadline-dev libsqlite3-dev # 使用pyenv安裝多版本Python root@miracle-ThinkPad-P50:~# pyenv install 3.6.2 root@miracle-ThinkPad-P50:~# pyenv install 2.7.1 # 查看安裝狀況 root@miracle-ThinkPad-P50:~# pyenv versions * system (set by /root/.pyenv/version) 2.7.1 3.6.2 # 安裝3.6.2的虛擬環境,名字是magedu_test root@miracle-ThinkPad-P50:~# pyenv virtualenv 3.6.2 magedu_test Requirement already satisfied: setuptools in /root/.pyenv/versions/3.6.2/envs/magedu_test/lib/python3.6/site-packages Requirement already satisfied: pip in /root/.pyenv/versions/3.6.2/envs/magedu_test/lib/python3.6/site-packages root@miracle-ThinkPad-P50:~# pyenv versions * system (set by /root/.pyenv/version) 2.7.1 3.6.2 3.6.2/envs/magedu_test magedu_test # 切換到虛擬環境 root@miracle-ThinkPad-P50:~# pyenv local magedu_test root@miracle-ThinkPad-P50:~# source ~/.bash_profile # 切換到虛擬環境 root@miracle-ThinkPad-P50:~# pyenv activate magedu_test pyenv-virtualenv: prompt changing will be removed from future release. configure `export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior. (magedu_test) root@miracle-ThinkPad-P50:~# pyenv versions system 2.7.1 3.6.2 3.6.2/envs/magedu_test * magedu_test (set by PYENV_VERSION environment variable) (magedu_test) root@miracle-ThinkPad-P50:~#
# 安裝 ipython (magedu_test) root@miracle-ThinkPad-P50:~# pip install ipython (magedu_test) root@miracle-ThinkPad-P50:~# ipython Python 3.6.2 (default, Dec 21 2017, 08:56:00) Type 'copyright', 'credits' or 'license' for more information IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help. In [1]: exit (magedu_test) root@miracle-ThinkPad-P50:~# # 安裝jupyter (magedu_test) root@miracle-ThinkPad-P50:~# pip install jupyter (magedu_test) root@miracle-ThinkPad-P50:~# jupyter notebook --ip=0.0.0.0 --allow-root
能夠在「deepin商店」直接搜索安裝,這裏再也不贅述github