Easy Pypi更新!1.2.1发布

非常的抱歉啊,这个底下的1.2.1呀,有一点错乱啊,可能是被某个人魔改了。。。

以下是修复重发:

复制代码
import os
import tkinter as tk
import tkinter.ttk as ttk
from tkinter.filedialog import askdirectory
import webbrowser

def init():
    global py_path,pip_path
    try:
        print('正在读取')
        py_path_f=open("./py_path.cfg",'r',encoding='utf-8')
        py_path=py_path_f.read()
        print(py_path)
        py_path_f.close()
        pip_path=py_path+"/scripts/pip.exe"
        print('读取完成')
        if py_path=='使用环境变量':
            print('使用环境变量')
            pip_path='pip'
    except Exception as e:
        print('读取设置失败:'+str(e))
        py_path=askdirectory(title='请选择Python安装路径')
        py_path_f=open("./py_path.cfg",'w',encoding='utf-8')
        py_path_f.write(py_path)
        py_path_f.close()
        pip_path=py_path+"/scripts/pip.exe"

def locate_pip():
    os.system("where pip")
    os.system("where pip3")
    print('==================================================')

def install(name):
    os.system(pip_path+" install "+name+' -i https://pypi.douban.com/simple')
    print('==================================================')

def uninstall():
    os.system(pip_path+" uninstall "+name)
    print('==================================================')

def about():
    os.system(py_path+"/python.exe -m pip install --upgrade pip -i https://pypi.douban.com/simple")
    print('==================================================')

def list_pkg():
    os.system(pip_path+" list")
    print('==================================================')

def upgrade():
    os.system(pip_path+" --version")
    print('==================================================')
    

win=tk.Tk()
win.title('Easy Pypi V1.2.1')
win.geometry('300x370')
win.resizable(0,0)

init()

name_enter=ttk.Entry(win)
name_enter.pack(fill=tk.X)

print('执行:     '+pip_path+' install '+'(库名)'+' -i https://pypi.douban.com/simple')

print('==================================================')

ttk.Button(win,text='安装',command=lambda:install(name_enter.get())).pack(fill=tk.X)
ttk.Button(win,text='卸载',command=uninstall).pack(fill=tk.X)
ttk.Button(win,text='列出所有已经安装的库',command=list_pkg).pack(fill=tk.X)
ttk.Button(win,text='更新PIP',command=about).pack(fill=tk.X)
ttk.Button(win,text='关于PIP',command=upgrade).pack(fill=tk.X)
ttk.Button(win,text='查看环境变量中有关PIP路径的配置',command=locate_pip).pack(fill=tk.X)

tk.Label(win,text='介绍',bg='lightgrey').pack(fill=tk.X)
tk.Label(win,text='这个程序可以方便地从Pypi安装第三方库').pack(fill=tk.X)
tk.Label(win,text='默认使用豆瓣镜像源以提升速度').pack(fill=tk.X)

tk.Label(win,text='使用步骤',bg='lightgrey').pack(fill=tk.X)
tk.Label(win,text='1.在窗口顶部的输入框内输入库名').pack(fill=tk.X)
tk.Label(win,text='2.点击点击相关的功能按钮').pack(fill=tk.X)
tk.Label(win,text='3.等待操作完毕(不要关闭弹出的命令提示符)').pack(fill=tk.X)


tk.Button(win,text='2022 By 人工智障',bg='lightgrey',bd=0,command=lambda:webbrowser.open("https://www.cnblogs.com/totowang")).pack(fill=tk.X)

win.mainloop()
复制代码

 


 

真·一天不到

主要是在列出所有已安装的库时修改参数使用PIP新版的列表视图

复制代码
import os
import tkinter as tk
import tkinter.ttk as ttk
from tkinter.filedialog import askdirectory
import webbrowser

def init():
    global py_path,pip_path
    try:
        print('正在读取')
        py_path_f=open("./py_path.cfg",'r',encoding='utf-8')
        py_path=py_path_f.read()
        print(py_path)
        py_path_f.close()
        pip_path=py_path+"/scripts/pip.exe"
        print('读取完成')
        if py_path=='使用环境变量':
            print('使用环境变量')
            pip_path='pip'
    except Exception as e:
        print('读取设置失败:'+str(e))
        py_path=askdirectory(title='请选择Python安装路径')
        py_path_f=open("./py_path.cfg",'w',encoding='utf-8')
        py_path_f.write(py_path)
        py_path_f.close()
        pip_path=py_path+"/scripts/pip.exe"

def locate_pip():
    os.system("where pip")
    os.system("where pip3")
    print('==================================================')

def install(name):
    os.system(pip_path+" install "+name+' -i https://pypi.douban.com/simple')
    print('==================================================')

def uninstall():
    os.system(pip_path+" uninstall "+name)
    print('==================================================')

def about():
    os.system(py_path+"/python.exe -m pip install --upgrade pip -i https://pypi.douban.com/simple")
    print('==================================================')

def list_pkg():
    os.system(pip_path+" list --format=columns")
    print('==================================================')
    

win=tk.Tk()
win.title('Easy Pypi V1.0 Beta')
win.geometry('300x370')
win.resizable(0,0)

init()

print('==================================================')

name_enter=ttk.Entry(win)
name_enter.pack(fill=tk.X)

print('执行:     '+pip_path+' install '+'(库名)'+' -i https://pypi.douban.com/simple')

ttk.Button(win,text='安装',command=lambda:install(name_enter.get())).pack(fill=tk.X)
ttk.Button(win,text='卸载',command=uninstall).pack(fill=tk.X)
ttk.Button(win,text='列出所有已经安装的库',command=list_pkg).pack(fill=tk.X)
ttk.Button(win,text='更新PIP',command=about).pack(fill=tk.X)
ttk.Button(win,text='关于PIP',command=lambda:os.system(pip_path+" --version")).pack(fill=tk.X)
ttk.Button(win,text='查看环境变量中有关PIP路径的配置',command=locate_pip).pack(fill=tk.X)

tk.Label(win,text='介绍',bg='lightgrey').pack(fill=tk.X)
tk.Label(win,text='这个程序可以方便地从Pypi安装第三方库').pack(fill=tk.X)
tk.Label(win,text='默认使用豆瓣镜像源以提升速度').pack(fill=tk.X)

tk.Label(win,text='使用步骤',bg='lightgrey').pack(fill=tk.X)
tk.Label(win,text='1.在窗口顶部的输入框内输入库名').pack(fill=tk.X)
tk.Label(win,text='2.点击点击相关的功能按钮').pack(fill=tk.X)
tk.Label(win,text='3.等待操作完毕(不要关闭弹出的命令提示符)').pack(fill=tk.X)


tk.Button(win,text='2022 By 人工智障',bg='lightgrey',bd=0,command=lambda:webbrowser.open("https://www.cnblogs.com/totowang")).pack(fill=tk.X)

win.mainloop()
复制代码

 

posted @   真_人工智障  阅读(31)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 使用C#创建一个MCP客户端
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示