Basics and install python

step1: Installation pyenv
1. Installation git

From the minimum system, pyenv mounting need git, so install git: yum install git -y

2.python安装依赖包
yum -y install gcc make patch gdbm-devel openssl-devel sqlite-devel readline-devel zlib-devel bzip2-devel

3. Create a user python

useradd python

4. Use the python user logon installation pyenv
perform
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash

curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash

Add the following in the user's python ~ / .bash_profile in

export PATH="/home/python/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

Save withdraw from the source ~ / .bash_profile

step2 use pyenv install python version

pyenv command
pyenv help install 
lists all available versions pyenv install --list 
install the specified version pyenv install ### (version number)
pyenv versions


1. Use cache installed
pyenv install ### -v
view the ~ / .pyenv directory, if there is no cache directory, create it mkdir cache
will advance you install the downloaded version of python into which attention can be

2. Set python version
pyenv global ####
Remember, this is because with global non-root user if the root user, much affected, caution
pyenv local ### is set to start from the current working directory inherited this setting down recursively
pyenv shell effect only in the current session

3.Virtualenv
plug-in plugins / pyenv the virtualenv-
pyenv the virtualenv 3.5.3 magedu353
pyenv versions
System
3.5.3
3.5.3 / Envs / magedu353
3.6.1
* magedu353 (by SET / Home / Python / wk / Project / CMDB /. python-version)
is really in the directory ~ / .pyenv / versions

4.pip通用配置
mkdir ~/.pip
vim ~/.pip/pip.conf
[global]
index-url=https://mirrors.aliyun.com/pypi/simple/
trusted-host=mirrors.aliyun.com
pip freeze >requiremnet.txt
pip install -r requirement


step3 安装ipython
pip install ipython
ipython

step4 安装jupyter
pip installjupyter
jupyter notebook help
jupyter notebook --ip=0.0.0.0 --no--browser

pip freeze > requirement
pip install -r requirement

Guess you like

Origin www.cnblogs.com/wangyi429111/p/11796696.html