First, install the pyenv
#系统环境 # cat/etc/redhat-release CentOS Linux release 7.2.1511 (Core) 1, installing git# yum-y install GIT2, installing pyenv# curl-l https://r Aw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | Bash or reference: Https://github.com/yyuu/pyenv-installer3, config environment variable # vim/etc/profile.d/pyenv.sh #定义的全局环境变量export path= "/root /.pyenv/bin: $PATH "eval" $ (pyenv init-) "eval" $ (pyenv Virtualenv-init-) "#. /etc/profile.d/pyenv.sh #载入一下
Second, install Python
1. Install the build tool # Yum-y install gcc make patch2, install dependent environment # Yum-y install gdbm-devel openssl-devel sqlite-devel readline-devel zlib- Devel bzip2-devel3, Upgrade Pyenv (the latest version 3.2 may not be in the pyenv) # pyenv update4, installing python3.5.2# pyenv install 3.5.2 #这块可能安装比较慢, need to wait a while. 5, using the domestic image installation # mkdir ~/.pyenv/cache# wget-c http://7d9qvq.com1.z0.glb.clouddn.com/Python-3.5.2.tgz # MV python-3.5.2.tar.gz ~/.pyenv/cache/python-3.5.2.tar.gz # pyenv Install 3.5.2
Three, Pyenv basic use method
1. Local command # pyenv versions* system (set by /root/.pyenv/version) 3.5.2 # pyenv local 3.5.2 #切换到3.5.2# python -vpython 3.5.2 #已经切换成功2, Global command # pyenv global 3.5.2 # The global switch to version 3.5, 2, is not recommended for this command 3, virtualenv command # pyenv virtualenv 3.5.2 bjwf # Create a python3.5.2 virtual environment in 3.5.2 template bjwf# ll ~/.pyenv/versions/ 3.5.2 &NBSP;&NBSP;&NBSP;BJWF&NBSP;->&NBSP;/ROOT/.PYENV/VERSIONS/3.5.2/ENVS/BJWF4, uninstall command # pyenv uninstall bjwf #卸载某个版本 (including virtual environment version) pyenv-virtualenv: remove /root/.pyenv/ versions/3.5.2/envs/bjwf? y# ll ~/.pyenv/versions/drwxr-xr-x 7 root root 63 jun 30 05:50 3.5.25, other commands # pyenv install –list #列出可安装的版本 # pyenv rehash #更新数据库 # pyenv versions #查看当前已安装的所有版本 # pyenv global 3.5.2 # Suggest never do # pyenv help #查看帮助Usage: pyenv <command> [<args>]some useful pyenv commands are: commands List all available pyenv commands local set or show the local application-specific python version global Set or show the global Python version shell set or show the shell-specific python version install install a python version using python-build uninstall Uninstall a specific Python version rehash rehash pyenv shims (run this after Installing executables) version show the current python version and its origin versions list all Python versions available to pyenv which Display the full path to an executable whence list all python versions that contain the given executablesee ' pyenv help <command> ' for information On a specifiC command. For full documentation, see: https://github.com/yyuu/pyenv#readme
Four, install Ipython,jupyter
1, configure the domestic mirror (pipe) # mkdir ~/.pip# vim ~/.pip/pip.conf[global]index-url = http:// MIRRORS.ALIYUN.COM/PYPI/SIMPLE/TRUSTED-HOST&NBSP;=&NBSP;MIRRORS.ALIYUM.COM2, installation Ipython# pip install --upgrade pip #我这块提升要先安装这个 # pip install ipyton# ipython #可以使用了Python 3.5.2 (default, jun 30 2016, 05:24:18) Type " Copyright ", " credits " or " License " for more information. Ipython 4.2.1 -- an enhanced interactive python.? -> introduction and overview of ipython ' s features.%quickref -> quick reference.help -> python ' S own help system.object? -> details about ' object ', use ' object?? ' for extra detailS.in [1]: print (' Hello world ') hello world3, installation jupyter# pip install jupyter# # jupyter-notebook --ip=0.0.0.0 --port=8888 --no-browser # Front Run [i 06:24:43.608 notebookapp] serving notebooks from local directory: /root[i 06:24:43.609 notebookapp] 0 active kernels [i 06:24:43.609 notebookapp] the jupyter notebook is running at: http://0.0.0.0:8888/ [i 06:24:43.609 notebookapp] use control-c to stop this server And shut down all kernels [i 06:24:58.443 notebookapp] 302 get / (192.168.110.253) 2.11ms[I 06:25:26.260 NotebookApp] Creating new Notebook in # nohup jupyter-notebook --ip=0.0.0.0 --port=8888 --no-browser & #后台运行
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/83/9D/wKiom1d30WyB1fYIAAC9Hf9FEhc538.png "title=" QQ picture 20160702223622.png "alt=" Wkiom1d30wyb1fyiaac9hf9fehc538.png "/>
This article is from the "Ask Heaven" blog, please make sure to keep this source http://79076431.blog.51cto.com/8977042/1795217
python3.5 Environment Preparation