CentOS6.9 Python环境配置(python2.7、pip、virtualenv)

yipeiwu_com5年前Python基础

python2.7

yum install -y zlib zlib-devel openssl openssl-devel mysql-devel gcc gcc-c++
wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
tar -zxvf Python-2.7.13.tgz
cd Python-2.7.13
./configure --prefix=/usr/local/python2.7
make
make install

 setuptools

wget https://files.pythonhosted.org/packages/dc/8c/7c9869454bdc53e72fb87ace63eac39336879eef6f2bf96e946edbf03e90/setuptools-33.1.1.zip
unzip setuptools-33.1.1.zip
cd setuptools-33.1.1
/usr/local/python2.7/bin/python2.7 setup.py install

 pip

wget https://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz --no-check-certificate
tar -zxvf pip-1.3.1.tar.gz
cd pip-1.3.1
/usr/local/python2.7/bin/python2.7 setup.py install

 建立软链接

cd /usr/bin
ln -s /usr/local/python2.7/bin/pip-2.7 ./pip2.7
ln -s /usr/local/python2.7/bin/python2.7 ./python2.7

 virtualenv

pip2.7 install virtualenv
cd /usr/bin
ln -s /usr/local/python2.7/bin/virtualenv ./ 

 virtualenvwrapper

pip2.7 install virtualenvwrapper 

mkdir ~/.virtualenvs
vi /etc/profile
  export WORKON_HOME=~/.virtualenvs
  export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python2.7
source /usr/local/python2.7/bin/virtualenvwrapper.sh
source /etc/profile 

总结

以上所述是小编给大家介绍的CentOS6.9 Python环境配置(python2.7、pip、virtualenv),希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!

相关文章

python实现猜数字游戏(无重复数字)示例分享

复制代码 代码如下:import time, random class GuessNum:    def __init__(self): &nbs...

python 数字类型和字符串类型的相互转换实例

一、python中字符串转换成数字 (方法1) 类中进行导入:import string str='555' num=string.atoi(str) num即为str转换成的数字...

对numpy中轴与维度的理解

对numpy中轴与维度的理解

NumPy's main object is the homogeneous multidimensional array. It is a table of elements (usu...

python批量获取html内body内容的实例

现在有一批完整的关于介绍城市美食、景点等的html页面,需要将里面body的内容提取出来 方法:利用python插件beautifulSoup获取htmlbody标签的内容,并批量处理。...

Python使用gensim计算文档相似性

pre_file.py #-*-coding:utf-8-*- import MySQLdb import MySQLdb as mdb import os,sys,string i...