V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
amiwrong123
V2EX  ›  程序员

想做 py 的离线安装包, pip freeze 总会把一些不相关的包弄进来?

  •  
  •   amiwrong123 · Sep 7, 2023 · 1354 views
    This topic created in 968 days ago, the information mentioned may be changed or developed.

    是利用 Anaconda 的虚拟环境创建了一个 py2 的虚拟环境,然后安装了 compiledb 这个库(为的是 在离线环境里面 安装这个库,这个库有一些依赖库)。

    本来想安装这个流程来走:

    pip freeze > requirements.txt
    pip download  -r requestments.txt  -d  ./pip_packages
    把东西都复制到离线电脑上去
    
    离线电脑上执行:
    pip install --no-index --find-links=d:\pip_packages -r requirements.txt 
    

    但是发现 txt 还有一些别的东西也进来:

    bashlex==0.18
    certifi==2020.6.20
    click==7.1.2
    compiledb==0.10.1
    enum34==1.1.10
    shutilwhich==1.1.0
    wincertstore==0.2
    

    比如 certifi wincertstore

    HashV2
        1
    HashV2  
       Sep 7, 2023
    不用 pip freeze
    手写每个 pip install 的库,这样可以不关注依赖
    lanlanye
        2
    lanlanye  
       Sep 7, 2023
    这种依赖库不算是不相关的库吧……总要安装的
    MIUIOS
        3
    MIUIOS  
       Sep 7, 2023
    车子要跑不需要轮子吗
    dayeye2006199
        4
    dayeye2006199  
       Sep 8, 2023
    先不提依赖的事情。。2023 年了,py2 该放下了
    amiwrong123
        5
    amiwrong123  
    OP
       Sep 8, 2023 via Android
    @lanlanye
    @totoro52
    好吧,不太懂 py 的这些库,原来这俩也属于必要的啊😂。因为我看 compiledb 依赖的库没有这俩
    amiwrong123
        6
    amiwrong123  
    OP
       Sep 8, 2023 via Android
    @HashV2
    手写是啥意思?在 requirement 里手写吗
    zlstone
        7
    zlstone  
       Sep 8, 2023
    怎么还用着 Python2 呢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   738 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 21:34 · PVG 05:34 · LAX 14:34 · JFK 17:34
    ♥ Do have faith in what you're doing.