Python Environment setup

Source: Internet
Author: User


Os:centos 6.6


First, pre-preparation

1, configure the Yum source, will install the dependent package to use

Wget-o/etc/yum.repos.d/centos-base.repo Http://mirrors.aliyun.com/repo/Centos-6.repowget-O/etc/yum.repos.d/ Epel.repo Http://mirrors.aliyun.com/repo/epel-6.repo

2. Install dependent packages

Yum-y install git gcc gcc-c++ make patch zlib-devel gdbm-devel openssl-devel sqlite-devel bzip2-devel bzip2-libs Readlin E-devel

Installing Pyenv

Method One:

1) First open https://github.com/yyuu/pyenv/releases, select a latest version, download the original file.

2) Create a folder under the $home directory, the name is. pyenv

3) Unzip the Master.zip file downloaded in the first step into the. pyenv

4) Add the following in the. bashrc

Export pyenv_root= "$HOME/.pyenv" Export path= "$PYENV _root/bin: $PATH" eval "$ (pyenv init-)"

5) Source ~/.BASHRC


Method Two:

$ git clone git://github.com/yyuu/pyenv.git ~/.pyenv$ echo ' export pyenv_root= ' $HOME/.pyenv ' ' >> ~/.bashrc$ Echo ' E Xport path= "$PYENV _root/bin: $PATH" ' >> ~/.bashrc$ Echo ' eval ' $ (pyenv init-) "' >> ~/.bashrc$ exec $SHELL-l


Installing Pyenv-virtualenv

Https://github.com/yyuu/pyenv-virtualenv download the file and unzip the execution./install.sh This allows you to create a virtual environment using pyenv virtualenv 3.4.2 name or: Pip Install Virtualenv

Pyenv Use the following

[[Email protected] /]# pyenv -husage: 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&nBSP; (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.

Pyenv install-l #列举所有的可用的python版本

Pyenv Install 2.7.8 #安装某个版本的python

Pyenv versions #列出所有已经安装的版本

Pyenv version #当前正在使用的python版本


Second, install Python

Install Python 3.4. Version 2 as follows

[[email protected]/]# pyenv install 3.4.2//Installation 3.4.2 version of Pythondownloading python-3.4.2.tgz...-> https:// www.python.org/ftp/python/3.4.2/Python-3.4.2.tgzInstalling python-3.4.2...patching file./lib/ssl.pypatching file. /modules/_ssl.cinstalled Python-3.4.2 to/root/.pyenv/versions/3.4.2

Create a virtual environment

[Email protected]/]# pyenv virtualenv 3.4.2 nyistignoring indexes:https://pypi.python.org/simple/requirement already Satisfied (use--upgrade to upgrade): Setuptools in/root/.pyenv/versions/3.4.2/envs/nyist/lib/python3.4/ Site-packagesrequirement already satisfied (use--upgrade to upgrade): Pip in/root/.pyenv/versions/3.4.2/envs/nyist/ Lib/python3.4/site-packagescleaning up ... [Email protected]/]#


To view the version that is already installed

[[email protected]/]# pyenv versions* System (set by/root/.pyenv/version) 3.4.1 3.4.2 3.4.2/envs/nyist nyist


Using a version of Python

# pyenv Local nyist//temporarily change Python version # PYENV global nyist//set global Python version


Ps:

    • Pip Install Ipython

    • Pip Install Jupyter

    • Jupyter Notebook



This article is from the "impermanence" blog, please be sure to keep this source http://1inux.blog.51cto.com/10037358/1744097

Python Environment setup

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.