欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

python2.7 vlrtualenv

程序员文章站 2022-07-14 15:52:20
...
如果是2.6用这个,最好用2.7,
virtualenv
http://www.360doc.com/content/12/0709/16/869651_223209860.shtml
python2.6.6
yum install python-virtualenv
virtualenv mysite
cd mysite/
source bin/activate
echo $VIRTUAL_ENV
echo $PATH


清除:
virtualenv --clear mysite

#-#######################################
如果是2.6.6
先修改/usr/bin/yum
头从python改成python26
然后备份/usr/bin/python
yum install zlib zlib-devel
./configure 编译python
easy_install:

想安装virtualenv
centos6.5的python2.6.6
由于新环境要求是2.7
所以安装python2.7
编译安装之前一定要
yum install openssl-devel
因为需要使用https下载文件
./configure --prefix=/usr/local/python278/
make 
make install
使用的时候不要使用python,默认还是
要指定/usr/local/python278/bin/python

安装easy_install
wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py -O - | /usr/local/python278/bin/python

注意/usr/local/python278/lib/python2.7/site-packages/
目录的变化
每次安装这里都会变

安装pip
tar xvf pip-1.5.6.tar.gz
cd pip-1.5.6
/usr/local/python278/bin/python setup.py instal


#virtualenv
easy_install virtualenv

##############
#virtualenv env
#source env/bin/activate

pip install django
pip install djangorestframework

pip install pygments

#mysql
yum install mysql-server
grant all privileges on *.* to root@% identified by 'haoning';
flush privileges;

#mysqldb
yum install mysql-devel
pip install MySQL-python



参考
http://www.django-rest-framework.org/tutorial/1-serialization#creating-a-model-to-work-with
django学习

参考
http://liuzhijun.iteye.com/blog/1872241
相关标签: python django