python安裝及導入庫的問題

Linux系統參考:Linux下Python環境搭建

http://f.dataguru.cn/forum.php?mod=viewthread&tid=36405&fromuid=4771


1.下載

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

版本:python-2.7.6.amd64.msi


ez_setup.py文件:


blog.victorjabur.com/2011/06/08/modules-python-library-compiled-for-windows-32-and-64-unofficial-windows-binaries-for-python/

MySQL-python-1.2.3.win-amd64-py2.7.exe [1.1 Mb] [Python 2.7] [64 bit] [JUN 08, 2011]
時,在註冊表中已經有了一個目錄,仿照這個目錄,我在註冊表中將目錄改爲了G:\StudyingSoft\Python2.7,真聰明!

http://www.crifan.com/python_install_module_mysql_mysqldb/


2.安裝Python

一直下一步到完成

3爲Python配置環境變量

6.jpg


7.jpg

2012-12-5 23:43 上傳
下載附件 (24.17 KB)


測試,Python安裝成功。


4.安裝easy_install

注意:win7 64位必須使用ez_setup.py進行安裝。方法是下載ez_setup.py後,在cmd下執行 python ez_setup.py,即可自動安裝setuptools。目前沒有直接的exe安裝版本。blog.csdn.net/dreamzml/article/details/8847879

setuptools安裝完成後的目錄如下:
 

5.爲setuptools配置環境變量

 
安裝twitter包

setup.py文件的使用:
% python setup.py build #編譯
% python setup.py install    #安裝

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環境搭建完成。

從cmd中安裝mysql的源碼(MySQL-python-1.2.5.zip),python setup.py install ,出現error: Unable to find vcvarsall.bat 的錯誤


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章