python 2.7.5找不到pip的问题

    不知是否是python版本太低还是什么原因,python目录下没有Scripts这个文件夹,很多指令都用不了。包括pip和easy_install。

    网上的教程是直接前往官网下载 pip下载链接

    下载解压后用命令行会发现,缺少另一个工具setuptools,这个是我python2.7.5遇到过的,其他版本不知有没有遇到。

    于是又去下载了setuptools  setuptools下载链接

     解压后,输入指令 python setup.py install回车

    会在python目录下产生Script文件夹。里面集成了很多.py的 文件。

    这时候再去刚刚下载的pip文件 夹,输入python setup.py install回车

    就可以安装python pip

    当然需要把python下的Scripts文件夹加入环境变量。


这里分享一个python注册到注册列表的一个py代码指令

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():
    print "begin RegisterPy "
    try:
        print "open key : %s"%regpath
        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 "*** EXCEPT: 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 "*** ERROR:Unable to register!" 
    print "*** REASON:You probably have another Python installation!"

def UnRegisterPy():
    #print "begin UnRegisterPy "
    try:
        print "open HKEY_CURRENT_USER key=%s"%(regpath)
        reg = OpenKey(HKEY_CURRENT_USER, regpath)
        #reg = OpenKey(HKEY_LOCAL_MACHINE, regpath)
    except EnvironmentError:  
        print "*** Python not registered?!"
        return
    try:
       DeleteKey(reg, installkey)
       DeleteKey(reg, pythonkey)
       DeleteKey(HKEY_LOCAL_MACHINE, regpath)
    except:
       print "*** Unable to un-register!"
    else:
       print "--- Python", version, "is no longer registered!"            

if __name__ == "__main__":  
    RegisterPy()


参考大神博客:https://blog.csdn.net/nomey_mr/article/details/55095984和https://blog.csdn.net/DongGeGe214/article/details/52199439

你可能感兴趣的:(开发工具)