导出程序所使用的的依赖包,并生成requirements文件
import os, sys

# 找到当前目录
project_root = os.path.dirname(os.path.realpath(__file__))
print(project_root)

# 找到解释器,虚拟环境目录
python_root = sys.exec_prefix
print(python_root)

# 拼接生成requirements命令
command = python_root + '\Scripts\pip freeze > ' + project_root + '\\requirements.txt'
print(command)

# 执行命令。
os.system(command)

 



相关文章:

  • 2022-12-23
  • 2021-07-07
  • 2021-09-28
  • 2021-05-29
  • 2021-09-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-25
  • 2022-03-08
  • 2021-07-11
  • 2021-08-17
  • 2022-03-02
相关资源
相似解决方案