在VS上使用 requirements.txt 管理必要的 Python 套件
產生環境 requirements.txt
方法一:透過指令
> pip freeze > requirements.txt
方法二:透過GUI
在檔案總管的「Python環境」中
- 在所要匯出的Python環境上按右鍵
- 點選「產生 requirements.txt」
- 就會在該專案下產生一個「requirements.txt」

匯入環境requirements.txt
如果是要匯入requirements.txt環境檔,必須先確認專案下有「requirements.txt」檔案,否則會無法安裝(呈現灰色,無法點)。接著:
- 新建一個環境
- 在該環境上點選右鍵
- 「從 requirements.txt安裝」
完成!
