houzhiqiang 最近的时间轴更新
houzhiqiang

houzhiqiang

V2EX 第 294281 号会员,加入于 2018-02-26 09:56:45 +08:00
根据 houzhiqiang 的设置,主题列表被隐藏
二手交易 相关的信息,包括已关闭的交易,不会被隐藏
houzhiqiang 最近回复了
27 天前
回复了 ztm0929 创建的主题 Python Python 导入自定义包的正确做法是什么?
@Maerd python xxx.py 会自动把当前目录加入 sys.path ,只需要正确找到顶层包就可以正确写出相对和绝对 import 的路径
sys.path 第一个元素的值为
python x.py # '.'
python -m x.x # '.'
python x/x.py # './x'
27 天前
回复了 ztm0929 创建的主题 Python Python 导入自定义包的正确做法是什么?
run.py # from app import run_app
|----app
|----models.py
|----__init__.py # def run_app
|----crawler
|---- a.py # from ..models import func

$ python run.py

|----app
|----__main__.py # from . import run_app
|----__init__.py # def run_app
|----models.py
|----crawler
|----a.py # from ..models import func

$ python -m app
27 天前
回复了 ztm0929 创建的主题 Python Python 导入自定义包的正确做法是什么?
根本原因是你要找到你的程序入口
编译完后要跑自带的测试集看编译是否正确的,越老的 python 版本越难静态编译
不然去 github 上找一个别人配置好的静态编译工程
我也静态编译过 Python3.10 但是不能完整的过测试集

$ ldd build/bin/python3.10
not a dynamic executable
$ file build/bin/python3.10
build/bin/python3.10: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, BuildID[sha1]=546463ab44b360fbe42e38f843548bbfc6ce4d61, for GNU/Linux 3.2.0, with debug_info, not stripped
$ ./build/bin/python3.10 -m pip install --upgrade pip
Looking in indexes: https://mirrors.cloud.aliyuncs.com/pypi/simple/
Requirement already satisfied: pip in ./build/lib/python3.10/site-packages (21.2.4)
Collecting pip
Downloading https://mirrors.cloud.aliyuncs.com/pypi/packages/d4/55/90db48d85f7689ec6f81c0db0622d704306c5284850383c090e6c7195a5c/pip-24.2-py3-none-any.whl (1.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 21.1 MB/s eta 0:00:00
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 21.2.4
Uninstalling pip-21.2.4:
Successfully uninstalled pip-21.2.4
Successfully installed pip-24.2
我选 deepseek
125 天前
回复了 xiaoqidev 创建的主题 创造者 独立开发者联名
import json
import base64
import urllib.parse

s = f'"{urllib.parse.unquote(base64.b64decode("JXU1RkFFJTIwJXU0RkUxJTIwc2F5aGVsbG9obw==".encode("utf-8"))).replace("%", "\\")}"'
print(json.loads(s))
127 天前
回复了 bxb100 创建的主题 Java 关于 swagger 的疑惑
FastAPI 先写接口定义(方法签名)然后就可以生成 openapi 了,部署到测试环境,接下来补充实现
@router.get("/users", name="get user")
def get_user(id: int) -> User:
# TODO: do something ...
return User(name="u", )
我记得一年期的合同试用期应该是不能超过一个月,不续签合同也要给赔偿
AGPL
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5284 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 12ms · UTC 01:25 · PVG 09:25 · LAX 18:25 · JFK 21:25
Developed with CodeLauncher
♥ Do have faith in what you're doing.