当前位置: 首页 > news >正文

Pypiserver

mkdir pypiserver
cd pypiserver
mkdir htpasswd

安装htpasswd

sudo apt install apache2-utils

生成密码

# 用户名为test
htpasswd -sc htpasswd/htpasswd test

在这里插入图片描述
编写docker-compose.yml

version: '3'
services:pypiserver:image: pypiserver/pypiserver:latestcontainer_name: pypiserverports:- "10005:8080" # 10005映射到8080volumes:- ./packages:/data/packages  # 本地包存储目录挂载到容器- ./htpasswd:/data/htpasswd # 认证文件(可选)command: run -P /data/htpasswd/htpasswd --fallback-url https://mirrors.bfsu.edu.cn/pypi/web/simple -a update,download,list /data/packages restart: always

如果你用的wsl,可以用powershell查查被排除的端口

netsh interface ipv4 show excludedportrange protocol=tcp

启动

sudo docker compose up -d

安装

sudo apt install twine

上传whl

twine upload --repository-url http://localhost:10005 ./dist/my_package-0.1.1-py3-none-any.whl -u test -p <密码>

在这里插入图片描述
测试

conda create -n test_my python==3.10.13 -y
conda activate test_mypip install -i http://test:<密码>@localhost:10005/simple --trusted-host localhost my_package
#pip install --no-cache-dir -U -i http://test:<密码>@localhost:10005/simple --trusted-host localhost my_package

运行

from my_package.my_file import my_func
my_func()

测试网页http://localhost:10005/simple/

在这里插入图片描述

http://www.xdnf.cn/news/645139.html

相关文章:

  • LeetCode 每日一题 2025/5/19-2025/5/25
  • 在langchain4j中 UserMessage注解和SystemMessage两个注解的区别
  • where is the examples of stm32h743i demo project inside of stm32cubeh7
  • 强化学习在大模型中的应用详解
  • 2025年第八届广西大学生程序设计大赛(正式赛)题解(更新中)
  • Java反射详解
  • 竞赛小算法总结(一):位运算,因数分解和“马拉车”算法含代码详解
  • C#学习
  • 有限时间 vs 固定时间 vs 预定时间滑模:稳定性分析与仿真验证方法对比(下)
  • leetcode 17. Letter Combinations of a Phone Number
  • MD5+盐保存密码
  • 用VMWare架飞牛nas 启用Intel千兆网卡
  • 人工智能导论复习 第一、二章
  • 从零开始上传预印版论文到 arXiv
  • SciPy是什么?是一个开源的 Python 算法库和数学工具包
  • 怎么判断股指期货空头增仓和多头增仓呢?
  • C++ 定义一个结构体,用class还是struct
  • DAY35作业
  • AI 赋能心理健康预测与干预:智能技术如何成为情绪“守护者”
  • 【分库分表】理论基础
  • Python训练营打卡Day36
  • YOLO11解决方案之区域追踪探索
  • Python二级考试
  • SOC-ESP32S3部分:12-1、任务通信-队列
  • 类和对象简要小记
  • 大模型应用开发之RAG
  • 【python】OOP编程从0到1
  • 前端常见的安全问题
  • 【监控】Node Exporter 介绍及应用
  • QT6安装与概念介绍