python 2.7.6 环境下配置库安装环境

准备工作(在接下来继续学习python中非常实用,建议安装以下任意一个配置工具setuptools,easy_install,pip)

一、WIN7 64位(安装的python2.7 32位)安装setuptools:

1、下载setuptools。setuptools是 Python Enterprise Application Kit(PEAK)的一个副项目,它 是一组Python的 distutilsde工具的增强工具。注意:安装版本要和python的版本一致
下载地址:setuptools-0.6c11.win32-py2.7.exe

2、安装setuptools,系统会自动寻找到python的安装地址(若提示未在注册表中寻找到python,参开以下步骤)点击下一步,完成。

安装第三方库出现 Python version 2.7 required, which was not found in the registry

建立一个文件 register.py 内容如下. 然后执行该脚本.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

# -*- coding: utf-8 -*-

"""

Created on Wed Sep 13 16:21:50 2017

 

@author: admin

"""

 

import sys 

     

from _winreg import * 

     

# tweak as necessary 

version = sys.version[:3

installpath = sys.prefix 

     

regpath = "SOFTWARE\\Python\\Pythoncore\\%s\\" % (version) 

installkey = "InstallPath" 

pythonkey = "PythonPath" 

pythonpath = "%s;%s\\Lib\\;%s\\DLLs\\" %

    installpath, installpath, installpath 

     

def RegisterPy(): 

    try

        reg = OpenKey(HKEY_CURRENT_USER, regpath) 

    except EnvironmentError as e: 

        try

            reg = CreateKey(HKEY_CURRENT_USER, regpath) 

            SetValue(reg, installkey, REG_SZ, installpath) 

            SetValue(reg, pythonkey, REG_SZ, pythonpath) 

            CloseKey(reg) 

        except

            print "*** Unable to register!" 

            return 

        print "--- Python", version, "is now registered!" 

        return 

    if (QueryValue(reg, installkey) == installpath and 

        QueryValue(reg, pythonkey) == pythonpath): 

        CloseKey(reg) 

        print "=== Python", version, "is already registered!" 

        return 

    CloseKey(reg) 

    print "*** Unable to register!" 

    print "*** You probably have another Python installation!" 

       

if __name__ == "__main__"

    RegisterPy() 

  

 

二、WIN7 64位(安装的python2.7 32位)安装easy_install:

1、下载easy_install:下载地址:https://pypi.python.org/pypi/ez_setup
(下载:easy_install

2、在cmd窗口进入该文件目录,执行:python setup.py install 进行安装

3、在系统环境变量path中添加python安装目录下的scripts文件夹
(在path末尾处添加;E:\python2.7.6\Scripts)

4、在cmd窗口中测试easy_install(若显示以下提示,则说明安装成功)
easy_install

三、WIN7 64位(安装的python2.7 32位)安装pip:

1、安装好easy_install之后, 在cmd窗口下,执行:easy_inatall pip

2、在cmd窗口中测试pip(若显示以下提示,则说明安装成功)
pip

 

其他库安装都按照以下步骤

1. 搜索需要安装的库https://pypi.org/project/

2.下载文件,然后解压,cmd进入解压后的路径,执行 python setup.py install 即可,eg:

参考 -- 来源:CSDN 原文:https://blog.csdn.net/echojosedream/article/details/52938136?utm_source=copy

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值