flask 环境安装

2016-06-22  本文已影响0人  高冷的晨曦
编译安装python前安装上依赖:
yum install openssl openssl-devel zlib zlib-devel   readline-devel  sqlite-devel  mysql-devel -y
安装python
wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz
tar xvf Python-2.7.8.tgz
cd Python-2.7.8
./configure --prefix=/usr/local/python27
make
make install
mv /usr/bin/python /usr/bin/python_old
ln -s /usr/local/python27/bin/python /usr/bin/python
python          # 查看版本
**解决YUM无法使用的问题**
       vim /usr/bin/yum 
       首行#!/usr/bin/python 替换为老版本python  #!/usr/bin/python2.4  注意可能为2.6
pip模块安装
wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
tar zxvf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11
python setup.py build
python setup.py install
wget https://pypi.python.org/packages/source/p/pip/pip-1.5.6.tar.gz#md5=01026f87978932060cc86c1dc527903e
tar zxvf pip-1.5.6.tar.gz
cd pip-1.5.6
python setup.py build
python setup.py install
加载环境变量
   vim /etc/profile
   export PATH=/usr/local/python27/bin:$PATH
   . /etc/profile
**pip用法**
   pip install Package             # 安装包 pip install requests
   pip show --files Package        # 查看安装包时安装了哪些文件
   pip show --files Package        # 查看哪些包有更新
   pip install --upgrade Package   # 更新一个软件包
   pip uninstall Package           # 卸载软件包
   pip list #列出所有包
   pip freeze > requirements.txt   #导出
   pip install -r requirements.txt   #安装
虚拟环境安装
pip install virtualenv
virtualenv test
cd test
source ./bin/activate
deactivate
上一篇 下一篇

猜你喜欢

热点阅读