Linux——学习环境搭建

终于决定将学习环境彻底转到Linux上来,下面记录一下转移学习环境的各种软件和环境的安装和配置。

1、centos自带python2.6,之前的博文已经说到已成功更新到python3.3,下面首先安装python的包管理器(pip或easy_install)

  CentOS 6.3安装pip

  CentOS安装python包管理安装工具pip的方法如下:

  写本文的时候,pip最新为 1.5.5

    wget --no-check-certificate https://github.com/pypa/pip/archive/1.5.6.tar.gz

  注意:wget获取https的时候要加上:--no-check-certificate

    tar zvxf 1.5.6.tar.gz    #解压文件
    cd pip-1.5.6/
    python setup.py install  #这一步出错了,需要安装setuptools
Traceback (most recent call last):
  File "setup.py", line 6, in <module>
    from setuptools import setup, find_packages
ImportError: No module named 'setuptools'    #需要安装setuptools
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       #安装setuptools时出现错误,缺少zlib module
 "Compression requires the (missing) zlib module")
RuntimeError: Compression requires the (missing) zlib module
  # 缺少zlib,安装setuptools时出错。
  # issue: RuntimeError: Compression requires the (missing) zlib module
  yum install zlib zlib-devel -y    #zlib安装成功!
  # 重make Python3.3.3再安装
  cd ../Python-3.3.3
  make  # 这时才注意先前make时缺了好多模块
  make install

由于zlib安装成功,setuptools也安装成功!开始安装pip。

python setup.py install 
...
Installed /usr/local/python3.3.3/lib/python3.3/site-packages/pip-1.5.6-py3.3.egg
Processing dependencies for pip==1.5.6
Finished processing dependencies for pip==1.5.6     #pip安装成功!版本1.5.6

使用pip命令出错:

can‘t find commond.    #需要增加环境变量

全局的对所有用户都可以的使用的PATH: 可以通过修改配置文件: /etc/bashrc 和 /etc/profile 来时配置,全局的PATH; 
例如: vi /etc/profile
在最后后加一行:PATH=THE_SET_GLOBLE_ENV_PATH:$PATH;
接着换行: export PATH
如果使其立即生效: source /etc/profile
# 缺少ssl模块,pip使用时出错
# issue: ImportError: cannot import name HTTPSHandler
yum install openssl openssl-devel -y
make  # Python-2.7.6目录
make install

pip可以使用!

2、安装Django

pip install Django
    Downloading/unpacking Django
      http://pypi.douban.com/simple/Django/ uses an insecure transport scheme (http).      Consider using https if pypi.douban.com has it available
      Downloading Django-1.7-py2.py3-none-any.whl (7.4MB): 7.4MB downloaded
      Installing collected packages: Django
    Successfully installed Django
    Cleaning up...      #django1.7安装成功!

3、这是我发现了这篇文章:http://my.oschina.net/songmingming/blog/225667——Django开发环境部署

  • 首先选择pip包管理器:Don't use easy_install, unless you like stabbing yourself in the face.
    Use pip. Two reasons, there may be more: - pip provides an uninstall command - if an installation fails in the middle, pip will leave you in a clean state.

    pip简介 Pip 是安装python包的工具,提供了安装包,列出已经安装的包,升级包以及卸载包的功能。
    Pip 是对easy_install的取代,提供了和easy_install相同的查找包的功能,因此可以使用easy_install安装的包也同样可以使用pip进行安装。
  • 安装virtualenv
  • 安装virtualenvwrapper
  • 安装pythonbrew
  • 安装辅助组件

    #yolk是一个列出python安装包的工具

    $ pip install yolk

   $ yolk -l 
  • 安装django

原文地址:https://www.cnblogs.com/Simon-xm/p/3954735.html