使用pip导出Python模块

  • 查看本地模块列表·
# 查看已安装模块
#pip list
or
#pip freeze
  • 打包本地模块
    • 打包单个模块
      pip download pyarmor -d /root
      #pip download 模块名 -d 路径
    • 打包全部模块
      # 1.重定向模块列表到文件中
      pip freeze > requirements.txt
      
      # 2.根据文件内的模块 进行导出
      # pip download -r 模块列表文件 -d 路径
      pip download -r requirements.txt -d /tmp

 

  •  安装模块
    • 离线安装
      # 安装单个模块
      # pip install 模块文件
      pip install /tmp/pyarmor-7.7.4-py2.py3-none-any.whl
      
      # 根据列表文件安装
      # --no-index 忽略包索引;-f 指定模块文件路径;-r 指定模块列表文件
      pip install --no-index -f /tmp -r requestments.txt
    • 在线安装
      # 指定版本号,在线安装
      pip install 模块名==版本号
      
      # 根据模块列表文件指定的版本号安装
      pip install -r requirements.txt

      原博客链接

posted @ 2023-02-28 13:40  人各有痔  阅读(378)  评论(0)    收藏  举报