天天看点

python开发环境搭建(windows版)

编者按:

  学习python需要的是搭建一套可用的开发环境,在开发的过程中,windows因为很多编译工具不能很好的去安装支持编译环境,所以会有很多绊脚的地方。本文尝试在windows环境下面整理安装一些比较难安装的第三方模块库。以帮助更多的朋友学习之便。

1.python27和python33、python34、python35环境的同时并发:

  在学习的过程中,有一些模块在python2.7版本上还没有兼容到python3版本,比如操作mysql的模块MySQL。所以需要我们的在win下面并发的搭建多个版本的python环境。就我所了解目前生产环境下面使用python3.4版本的居多(除了使用python2版本之外),但为了尝试python3版本的一些新特性和从版本2到3的过渡,所以这里尝试构建python3版本的3个版本,以供参考!

python各常用版本下载链接: 

  python2.7.11 win32:https://www.python.org/ftp/python/2.7.11/python-2.7.11.msi
  python2.7.11 win64:https://www.python.org/ftp/python/2.7.11/python-2.7.11.amd64.msi


  python3.3.5 win32: https://www.python.org/ftp/python/3.3.5/python-3.3.5.msi 
  python3.3.5 win64:https://www.python.org/ftp/python/3.3.5/python-3.3.5.amd64.msi


  python3.4.4 win32:https://www.python.org/ftp/python/3.4.4/python-3.4.4.msi
  python3.4.4 win64:https://www.python.org/ftp/python/3.4.4/python-3.4.4.amd64.msi


  python3.5.1 win32:https://www.python.org/ftp/python/3.5.1/python-3.5.1.msi
  python3.5.1 win64:https://www.python.org/ftp/python/3.5.1/python-3.5.1.amd64.msi
      

python版本安装: 

  在安装python各个版本的时候使用这样目录:

    路径            python运行程序重命名

    path/Python27         python2.exe python27.exe  pip2.exe pip27.exe easy_install2.exe easy_install27.exe
    path/Python33      python33.exe pip33.exe easy_install33.exe
    path/Python34      python34.exe pip34.exe easy_install34.exe
    path/Python35       python3.exe python35.exe pip35.exe easy_install35.exe
  环境变量设置:
    python27=D:\Program Files\Python27\;D:\Program Files\Python27\Scripts;D:\Program Files\Python27\Lib;D:\Program Files\Python27\Lib\site-packages;D:\Program Files\Python27\DLLs
    python33=D:\Program Files\Python33\;D:\Program Files\Python33\Scripts;D:\Program Files\Python33\Lib;D:\Program Files\Python33\Lib\site-packages;D:\Program Files\Python33\DLLs
    python34=D:\Program Files\Python34\;D:\Program Files\Python34\Scripts;D:\Program Files\Python34\Lib;D:\Program Files\Python34\Lib\site-packages;D:\Program Files\Python34\DLLs
    python35=D:\Program Files\Python35\;D:\Program Files\Python35\Scripts;D:\Program Files\Python35\Lib;D:\Program Files\Python35\Lib\site-packages;D:\Program Files\Python35\DLLs
      

2. python27、python34、python35在安装的时候默认将pip工具进行安装,包括setuptools也一并安装,但在python33中需要自行安装

  首先获取setuptools:

    https://pypi.python.org/packages/source/s/setuptools/setuptools-20.3.tar.gz#md5=1b6ec3c0cc7e15ed67fe8f0fd1d899d0 

    解压之后使用python33 setup.py install 进行安装

  其次获取pip:

    https://pypi.python.org/packages/source/p/pip/pip-8.1.1.tar.gz#md5=6b86f11841e89c8241d689956ba99ed7 

      解压之后使用python33 setup.py install 进行安装

3. 编译环境:

  python2.7提供一个编译工具:Microsoft Visual C++ Compiler for Python 2.7。用户安装这个工具之后就可以解决这个错误:error: Unable to find vcvarsall.bat。下载地址:https://www.microsoft.com/en-us/download/details.aspx?id=44266 。

  python3.X暂时没有解决上述问题。留待后续补充!

4.常用模块安装:

  windows下配置相关python开发环境-常用模块

windows下使用python开发环境常见问题解决集锦:

1. python35&&python27在windows启动时报错解决方案

2. Python version 3.3 required, which was not found in the registry

3. windows下面pip、easy_install无法使用(Fatal error to launcher)