生成python 依賴文件


1.生成requirement 文件的兩種方式

  1. 'pip freeze ' > requirements.txt --會將環境中的依賴包全都加入(不推薦)
  
  2. 項目用到生成依賴
  '# 安裝
  pip install pipreqs
  # 在當前目錄生成
  pipreqs . --encoding=utf8 --force'     
  
 3. 安裝requirement依賴的方式
       pip install -r requirement.txt

2.生成pipfile和Pipfile.lock

1.'pip freeze -p Pipfile'      生成pipfile
  'pip freeze -p different_pipfile' 生成 different_pipfile.lock
2. 安裝和管理pipenv    
        pipenv --where  : 尋找項目根目錄
        pipenv -rm :刪除環境        
        pipenv install --dev 安裝Pipfile 中dev 環境所列的所有包
        pipenv uninstall :卸載所有包
        pipenv install pytest --dev :在dev 環境中安裝pytest包
        pipenv lock :確認 Pipfile 中所有包已安裝,並根據安裝版本生成Pipfile
        pipenv shell :應用虛擬環境
        exit :退出


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM