Windows下Python环境搭建(包括Win7 64位下安装setuptools)

Linux系统参考:Linux下Python环境搭建
http://f.dataguru.cn/forum.php?mod=viewthread&tid=36405&fromuid=4771



系统环境

电脑型号         联想 ThinkPadT410 笔记本电脑

操作系统         Windows 7 旗舰版 64 SP1 (DirectX 11 )

处理器     英特尔 Core i5 M560 @ 2.67GHz 双核笔记本处理器

主板         联想 2522NT7 (英特尔 QM57 芯片组)

内存         6 GB ( 尔必达 DDR31067MHz / 尔必达 DDR3 1333MHz )


1.下载

Python

地址:http://www.python.org/getit/

版本:python-2.7.3.amd64.msi


setuptoolshttp://pypi.python.org/pypi/setuptools#windows

ez_setup.py文件:http://peak.telecommunity.com/dist/ez_setup.py


numpy

地址:http://www.lfd.uci.edu/~gohlke/pythonlibs/

版本:numpy-unoptimized-1.6.2.win-amd64-py2.7.exe


2.安装Python

1.jpg 

选择安装路径:


2.jpg 


3.jpg 


4.jpg 


除了选择安装路径外,其他的基本都可以默认了,一直到安装完成。此时的目录结构如下:


5.jpg



3为Python配置环境变量

6.jpg


7.jpg


测试,Python安装成功。


4.安装setuptools

官网声称.exe版本的不支持64位Windows系统,推荐使用ez_setup.py自动安装。据说,有筒子32位的exe文件在64位系统上也能用,我就不试了,按照官方的指导来吧,免得以后出些莫名其妙的问题。

8.jpg




打开 http://peak.telecommunity.com/dist/ez_setup.py ,把页面上的代码copy一份保存为ez_setup.py,也可以下载:    ez_setup.rar (3.78 KB, 下载次数: 1, 售价: 1 金子)


在命令行窗口下执行即可,前提是可以联网。

8_2.jpg




  1. D:\>ez_setup.py
  2. Downloading http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
  3. Processing setuptools-0.6c11-py2.7.egg
  4. Copying setuptools-0.6c11-py2.7.egg to d:\python27\lib\site-packages
  5. Adding setuptools 0.6c11 to easy-install.pth file
  6. Installing easy_install-script.py script to D:\Python27\Scripts
  7. Installing easy_install.exe script to D:\Python27\Scripts
  8. Installing easy_install.exe.manifest script to D:\Python27\Scripts
  9. Installing easy_install-2.7-script.py script to D:\Python27\Scripts
  10. Installing easy_install-2.7.exe script to D:\Python27\Scripts
  11. Installing easy_install-2.7.exe.manifest script to D:\Python27\Scripts

  12. Installed d:\python27\lib\site-packages\setuptools-0.6c11-py2.7.egg
  13. Processing dependencies for setuptools==0.6c11
  14. Finished processing dependencies for setuptools==0.6c11
复制代码


setuptools安装完成后的目录如下:
9.jpg 

5.为setuptools配置环境变量

10.jpg 


6.使用easy_install

安装django:

  1. C:\Users\Biao>easy_install
  2. error: No urls, filenames, or requirements specified (see --help)

  3. C:\Users\Biao>easy_install django
  4. Searching for django
  5. Reading http://pypi.python.org/simple/django/
  6. Reading http://www.djangoproject.com/
  7. Reading http://www.djangoproject.com/m/bad-installer.txt
  8. Best match: Django 1.4.2
  9. Downloading https://www.djangoproject.com/m/releases/1.4/Django-1.4.2.tar.gz
  10. Processing Django-1.4.2.tar.gz
  11. Running Django-1.4.2\setup.py -q bdist_egg --dist-dir c:\users\biao\appdata\local\temp\easy_install-tahhsu\Django-1.4.2\egg-dist-tmp-0hpiac
  12. zip_safe flag not set; analyzing archive contents...
  13. django.contrib.admindocs.views: module references __file__
  14. django.contrib.auth.tests.context_processors: module references __file__
  15. django.contrib.auth.tests.forms: module references __file__
  16. django.contrib.auth.tests.views: module references __file__
  17. django.contrib.flatpages.tests.csrf: module references __file__
  18. django.contrib.flatpages.tests.middleware: module references __file__
  19. django.contrib.flatpages.tests.templatetags: module references __file__
  20. django.contrib.flatpages.tests.views: module references __file__
  21. django.contrib.formtools.tests.__init__: module references __file__
  22. django.contrib.formtools.tests.wizard.namedwizardtests.tests: module references __file__
  23. django.contrib.formtools.tests.wizard.wizardtests.tests: module references __file__
  24. django.contrib.gis.geometry.test_data: module references __file__
  25. django.contrib.gis.tests.geo3d.tests: module references __file__
  26. django.contrib.gis.tests.geogapp.tests: module references __file__
  27. django.contrib.gis.tests.layermap.tests: module references __file__
  28. django.contrib.sitemaps.tests.base: module references __file__
  29. django.contrib.staticfiles.storage: module references __file__
  30. django.core.management.sql: module references __file__
  31. django.core.management.templates: module references __path__
  32. django.core.management.__init__: module references __file__
  33. django.core.management.__init__: module references __path__
  34. django.core.management.commands.loaddata: module references __file__
  35. django.core.management.commands.loaddata: module references __path__
  36. django.core.management.commands.makemessages: module references __file__
  37. django.core.servers.basehttp: module references __path__
  38. django.db.utils: module references __file__
  39. django.db.models.loading: module references __file__
  40. django.template.loaders.app_directories: module references __file__
  41. django.test._doctest: module references __file__
  42. django.test._doctest: module MAY be using inspect.getsourcefile
  43. django.utils.autoreload: module references __file__
  44. django.utils.module_loading: module references __path__
  45. django.utils.version: module references __path__
  46. django.utils.translation.trans_real: module references __file__
  47. django.utils.translation.__init__: module references __file__
  48. django.utils.unittest.collector: module references __file__
  49. django.utils.unittest.loader: module references __file__
  50. django.views.i18n: module references __file__
  51. Adding django 1.4.2 to easy-install.pth file
  52. Installing django-admin.py script to D:\Python27\Scripts

  53. Installed d:\python27\lib\site-packages\django-1.4.2-py2.7.egg
  54. Processing dependencies for django
  55. Finished processing dependencies for django

  56. C:\Users\Biao>python
  57. Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win32
  58. Type "help", "copyright", "credits" or "license" for more information.
  59. >>> import django
  60. >>> exit()
复制代码

django已安装成功。

安装numpy:

11.jpg 

  1. C:\Users\Biao>easy_install numpy
  2. Searching for numpy
  3. Reading http://pypi.python.org/simple/numpy/
  4. Reading http://numpy.scipy.org
  5. Reading http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103
  6. Reading http://numeric.scipy.org
  7. Best match: numpy 1.6.2
  8. Downloading http://pypi.python.org/packages/source/n/numpy/numpy-1.6.2.zip#md5=7e13c931985f90efcfa0408f845d6fee
  9. error: MD5 validation failed for numpy-1.6.2.zip; possible download problem?

  10. C:\Users\Biao>
复制代码


easy-install方式安装失败,这是因为我公司限网了,下载不下了。改用exe文件安装,安装文件为: numpy-unoptimized-1.6.2.win-amd64-py2.7.exe。下载完成后直接运行就可以了:
12.jpg 

默认会找到Python的安装路径:
13.jpg 
14.jpg 

15.jpg 

16.jpg 

numpy安装成功。 


至此,在Windows下Python环境搭建完成。


原文地址:http://f.dataguru.cn/thread-36396-1-1.html

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值