Menu



Manage

Cord > Project_AI이미지 처리 전체 다운로드
Project_AI이미지 처리 > venv/install.py Lines 24 | 1009 바이트
다운로드

                        import subprocess
import os

# requirements.txt에 존재하는 패키지 설치
def install_from_requirements(file_path):
    if os.path.exists(file_path):
        try:
            import rembg
            print("rembg 이미 설치되어 있습니다.")
        except ImportError:
            print(f"{file_path} 파일에서 패키지를 설치합니다...")
            try:
                print("rembg 설치합니다...")
                subprocess.check_call(['python', '-m', 'pip', 'install', 'rembg'])
                import email_validator
                print(f"설치된 rembg 버전: {email_validator.__version__}")
            except subprocess.CalledProcessError as e:
                print(f"{file_path} 파일의 패키지 설치 중 오류가 발생했습니다: {e}")
    else:
        print(f"{file_path} 파일이 존재하지 않습니다.")

if __name__ == "__main__":
    requirements_file = 'requirements.txt'
    install_from_requirements(requirements_file)