1. Reliance
Pyenv installation using Git
# yum Install git-y# yum-y install gcc make patch gdbm-devel openssl-devel sqlite-devel readline-devel zlib-devel bzip2- Devel
2. Create a user python
# useradd python# passwd python
3. Sign in with a Python user
Su–python
4. Start Deployment pyenv
Pyenv Installation Method:
The following describes the installation of pyenv using the Pyenv-installer method
$ curl-l Https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | Bash
Append to Python user's ~/.bash_profile
Export path= "/home/python/.pyenv/bin: $PATH" eval "$ (pyenv init-)" eval "$ (pyenv Virtualenv-init-)" $ source ~/.bash_ Profile
Getting Started with pyenv
$ python-v$ pyenv Versions
5. Pyenv Usage Introduction
$ pyenv # show Pyenv help $ pyenv Global x.x.x # Set Global Python version (apply to entire system) $ pyenv Local x.x.x # set native Python version (this setting is inherited under subdirectories) $ pyenv S Hell x.x.x # Set the session Python version (acting on the current shell session) $ pyenv Help Install # View Sub-command assist $ pyenv Install–list # List all versions supported by pyenv
5.1 Installing a specific Python version
5.1.1 Online installation Specifies the Python version
$ pyenv Install 3.5.3$ pyenv versions
5.1.2. Installing the specified Python version using the cached method
$ pyenv Install 3.5.3-v
> Cache directory, if the directory does not exist, create it yourself, in the ~/.pyenv directory, the new cache directory, into the downloaded Python file.
> Not sure which file to take, put the downloaded 3 files in.
6. pyenv using VIRTUALENV Virtual environment settings
> Pyenv has its own virtualenv plug-in, plugins/pyenv-virtualenv
6.1 Creating a specified version of the virtual environment space
$ pyenv virtualenv 3.6.1 magedu361 # created a 3.6.1 version of the virtual environment $ pyenv Versions # Real directory in. pyenv/versions/* System (Set By/home/pytho N/.pyenv/version) 3.5.33.6.13.6.1/envs/magedu361magedu361
6.2 Using Virtual environment space
$ mkdir-p magedu361/projects/cmdb[[email protected] ~]$ CD Magedu361/projects/cmdb[[email protected] cmdb]$ pyenv local m agedu361 (magedu361) [[email protected] cmdb]$ CD. [Email protected] projects]$ CD cmdb/
7. Deploying Ipython and Jupyter
7.1 Configuring PIP
VI ~/.pip/pip.conf[global]index-url=https://mirrors.aliyun.com/pypi/simple/trusted-host=mirrors.aliyun.com
In a different virtual environment, install the Redis package and use the PIP list to see the effect.
$ pip-v
7.2 Installing Ipython
$ pip Install ipython$ Ipython
7.3 Deployment of Jupyter
Installing the Jupyter will also automatically install the Ipython
$ pip Install jupyter$ Jupyter Notebook Help
Build configuration file
$ jupyter notebook–generate-config$ jupyter Notebook password # set Jupyter login password (can also be written to the configuration file) $ jupyter notebook–ip=0.0.0. 0–no-browser
Generate password
$ ipythonin [1]: From Notebook.auth import Passwdin [2]: passwd () Enter password:verify password:out[2]: ' sha1:ce23d945972 f:34769685a7ccd3d08c84a18c63968a41f1140274′# copy password ' Sha:ce ... '
Modifying the default configuration file
Vim ~/.jupyter/jupyter_notebook_config.pyc.notebookapp.ip= ' * ' # listens on all ips # C.notebookapp.password = ' String ' # the String should be of the form TYPE:SALT:HASHED-PASSWORDC. Notebookapp.password = ' Sha:ce ... The cipher that was just copied ' C. Notebookapp.open_browser = False # Disables automatic opening of browser C. Notebookapp.port =8888 #随便指定一个端口
Start Jupyter Notebook
Jupyter Notebook
Reference Address:
Python Environment porting
Pip freeze > Requirementpip install-r Requirement
This article is from the "Marco Linux Training" blog, so be sure to keep this source http://mageedu.blog.51cto.com/4265610/1964666
Linux under multi-version Python environment configuration