user-pip 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: user-pip
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: 对原版pip的简单封装库,通过subprocess调用pip命令
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Dynamic: license-file
|
|
10
|
+
|
|
11
|
+
# user-pip v0.0.1
|
|
12
|
+
|
|
13
|
+
> **本库使用MIT许可证,在分发时请保留署名!谢谢!**
|
|
14
|
+
|
|
15
|
+
> 本库尚在开发阶段,可能有bug,如有bug请及时反馈,谢谢。
|
|
16
|
+
|
|
17
|
+
> 本库使用报错码形式报错均使用报错码形式(如2*000001等),可用[仓库yunchu-dev-specs](https://github.com/yunchu-git/yunchu-dev-specs)查看报错码
|
|
18
|
+
|
|
19
|
+
python的pip是一个库,**但是官方不建议直接调用**,本库使用`subprocess`标准库执行命令的方式来进行pip的python调用,调用时调用名为`user_pip`
|
|
20
|
+
|
|
21
|
+
# 安装方法
|
|
22
|
+
```bash
|
|
23
|
+
pip install user-pip
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
# 使用示例
|
|
27
|
+
1. 安装库:
|
|
28
|
+
```Python
|
|
29
|
+
install("wxpython","pip3","https://mirrors.ctyun.cn/pypi/simple/")
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
参数1:要安装的库 参数2:pip对应的python版本 参数3:镜像源
|
|
33
|
+
|
|
34
|
+
2. 卸载库:
|
|
35
|
+
```Python
|
|
36
|
+
uninstall("wxpython","pip3",True)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
参数1:要卸载的库 参数2:pip对应的python版本 参数3:确认删除
|
|
40
|
+
|
|
41
|
+
3. 更新库:
|
|
42
|
+
```Python
|
|
43
|
+
upgrade("wxpython","pip3","https://mirrors.ctyun.cn/pypi/simple/")
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
参数1:要更新的库 参数2:pip对应的python版本 参数3:镜像源
|
|
47
|
+
|
|
48
|
+
4. 查看库:
|
|
49
|
+
```Python
|
|
50
|
+
pip_list("pip3")
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
参数1:pip对应的python版本
|
|
54
|
+
|
|
55
|
+
5. 查看可更新库:
|
|
56
|
+
```Python
|
|
57
|
+
pip_upgrade_list("pip3","https://mirrors.ctyun.cn/pypi/simple/")
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
参数1:pip对应的python版本 参数2:镜像源
|
|
61
|
+
|
|
62
|
+
6. 安装pip:
|
|
63
|
+
```Python
|
|
64
|
+
pip_install("python3","pip3")
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
参数1:python版本 参数2:pip对应的python版本
|
|
68
|
+
|
|
69
|
+
7. 更新pip:
|
|
70
|
+
```Python
|
|
71
|
+
pip_upgrade("python3","pip3")
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
参数1:python版本 参数2:pip对应的python版本
|
|
75
|
+
|
|
76
|
+
8. 安装指定版本:
|
|
77
|
+
```Python
|
|
78
|
+
install_version("wxpython","4.3.2","pip3","https://mirrors.ctyun.cn/pypi/simple/")
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
参数1:要安装的库 参数2:版本 参数3:pip对应的python版本 参数4:镜像源
|
|
82
|
+
|
|
83
|
+
9. 安装whl:
|
|
84
|
+
```Python
|
|
85
|
+
install_whl(r"C:/abc.whl","pip3")
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
参数1:whl文件地址 参数2:pip对应的python版本
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
user_pip.py,sha256=Ca_KEcWW-IoaV9i1leZcONuMuD2fn4q887aHxyOxlXQ,1621
|
|
2
|
+
user_pip-0.0.1.dist-info/licenses/LICENSE,sha256=aodHtO0cclUXERiWGvVpfFPnu4t-FX6SQRRitzQEjrM,1063
|
|
3
|
+
user_pip-0.0.1.dist-info/METADATA,sha256=XkRSeMsX2p-P0pB6uQd2snaZxWykiQr-1I1jmVAHlBw,2289
|
|
4
|
+
user_pip-0.0.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
5
|
+
user_pip-0.0.1.dist-info/top_level.txt,sha256=zHRxvZzDHoRrueC92Y0jqxaTqNnc8cVW0N_pAKeBoH4,9
|
|
6
|
+
user_pip-0.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 yunchu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
user_pip
|
user_pip.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import subprocess
|
|
2
|
+
import warnings
|
|
3
|
+
|
|
4
|
+
def print_output (order,capture_output=True,text=True,shell=True):
|
|
5
|
+
result = subprocess.run(order, capture_output=capture_output,text=text,shell=shell)
|
|
6
|
+
print(result.stdout)
|
|
7
|
+
if result.stderr:
|
|
8
|
+
print(result.stderr)
|
|
9
|
+
|
|
10
|
+
def pip_install (python="python",pip="pip"):
|
|
11
|
+
print_output("curl.exe https://bootstrap.pypa.io/get-pip.py -o get-pip.py")
|
|
12
|
+
print_output(f"{python} get-pip.py")
|
|
13
|
+
print_output(f"{python} -m {pip} install --upgrade pip")
|
|
14
|
+
|
|
15
|
+
def pip_upgrade (python="python",pip="pip"):
|
|
16
|
+
print_output(f"{python} -m {pip} install --upgrade pip")
|
|
17
|
+
|
|
18
|
+
def install (name,pip="pip",mirror="https://pypi.tuna.tsinghua.edu.cn/simple"):
|
|
19
|
+
print_output(f"{pip} install {name} -i {mirror}")
|
|
20
|
+
|
|
21
|
+
def install_version(name,version,pip="pip",mirror="https://pypi.tuna.tsinghua.edu.cn/simple"):
|
|
22
|
+
print_output(f"{pip} install {name}=={version} -i {mirror}")
|
|
23
|
+
|
|
24
|
+
def install_whl(file_path,pip="pip"):
|
|
25
|
+
print_output(f'{pip} install "{file_path}"')
|
|
26
|
+
|
|
27
|
+
def uninstall (name,pip="pip",confirm=False):
|
|
28
|
+
if confirm:
|
|
29
|
+
if name == "pip":
|
|
30
|
+
raise RuntimeError("2*000001")
|
|
31
|
+
else:
|
|
32
|
+
print_output(f"{pip} uninstall {name} -y")
|
|
33
|
+
else:
|
|
34
|
+
warnings.warn("1*000001",UserWarning)
|
|
35
|
+
|
|
36
|
+
def upgrade (name,pip="pip",mirror="https://pypi.tuna.tsinghua.edu.cn/simple"):
|
|
37
|
+
print_output(f"{pip} install {name} --upgrade -i {mirror}")
|
|
38
|
+
|
|
39
|
+
def pip_list (pip="pip"):
|
|
40
|
+
print_output(f"{pip} list")
|
|
41
|
+
|
|
42
|
+
def pip_upgrade_list (pip="pip",mirror="https://pypi.tuna.tsinghua.edu.cn/simple"):
|
|
43
|
+
print_output(f"{pip} list -o -i {mirror}")
|