V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
find456789
V2EX  ›  问与答

Python 如何在管理常用的公共库呢?

  •  
  •   find456789 · 2018-11-22 19:06:52 +08:00 · 1599 次点击
    这是一个创建于 1974 天前的主题,其中的信息可能已经有所发展或是发生改变。

    mac,

    python3,

    经常写代码, 会有一些重复代码在不同项目中,

    每次使用都要复制文件到对应项目,感觉很费神,

    有什么自动化,或者更聪明的办法吗

    谢谢

    5 条回复    2018-11-22 20:16:47 +08:00
    ipwx
        1
    ipwx  
       2018-11-22 19:32:09 +08:00   ❤️ 1
    添加 setup.py
    然后用上 requirements.txt
    find456789
        2
    find456789  
    OP
       2018-11-22 19:45:18 +08:00
    @ipwx
    谢谢, 感觉好像更复杂了, 这些代码片段是我自己写的, 没有发布到 pypi
    noobsheldon
        3
    noobsheldon  
       2018-11-22 19:45:51 +08:00 via Android
    git submodule
    andylsr
        4
    andylsr  
       2018-11-22 19:47:43 +08:00 via Android
    自己打包~
    ipwx
        5
    ipwx  
       2018-11-22 20:16:47 +08:00
    @find456789 pip 可以直接安装某个目录,或者某个 git repo。

    比如 pip install git+https://github.com/haowen-xu/tfsnippet.git
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5218 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 108ms · UTC 01:24 · PVG 09:24 · LAX 18:24 · JFK 21:24
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.