首页 > orther > notice > 在centos6中安装python2.7和pip,virtualenv
2014
04-30

在centos6中安装python2.7和pip,virtualenv

选择了centos6来作为服务器系统 按照以下的步骤,可以方便地在centos下使用python2.7,pip,virtualenv

1.准备工作

yum groupinstall "Development tools"
yum install MySQL-python zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel -y
yum install python-psycopg2 -y
yum install MySQL-python -y
yum install gcc python-devel -y
yum install python-memcached -y

2.下载并安装python2.7(注意make altinstall)

wget http://python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
tar xf Python-2.7.6.tar.xz
cd Python-2.7.6
./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make altinstall

3.安装pip

wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
python2.7 ez_setup.py
easy_install-2.7 pip
pip install tornado
pip install requests

4.安装virtualenv

pip2.7 install virtualenv

接下来,直接使用virtualenv xxx创建隔离的运行环境,其中python版本默认为2.7

如果在virtualenv外,则需要使用python2.7来调用2.7版本

最后编辑:
作者:admin
捐 赠如果您觉得这篇文章有用处,请支持作者!鼓励作者写出更好更多的文章!

留下一个回复