프로그래밍48 [Python] 번역 프로그램 - 구글 번역기 라이브러리 설치 2021.11월 기준 안정적인 라이브러리 버전 pip install googletrans==4.0.0-rc1 import googletrans # googletrans를 불러옴 translator = googletrans.Translator() # dest : 번역 후 언어, src: 번역할 문자의 언어로 auto가 기본으로 되어있음. str1 = "행복하세요" result1 = translator.translate(str1, dest='en', src='auto') print(f"행복하세요 => {result1.text}") str2 = "I am happy" result2 = translator.translate(str2, dest='ko', src='en') prin.. 2022. 11. 28. [Python] 컴퓨터 정보 확인 코드 psutil 라이브러리 - 컴퓨터의 정보를 확인할 때 사용 pip install psutil import psutil # CPU의 속도 출력 cpu = psutil.cpu_freq() print(cpu) # CPU의 물리코어 수 출력 cpu_core = psutil.cpu_count(logical = False) print(cpu_core) # 메모리 정보 출력 memory = psutil.virtual_memory() print(memory) # 디스크 정보 출력 disk = psutil.disk_partitions() print(disk) # 네트워크를 통해 보내고 받은 데이터량 출력 net = psutil.net_io_counters() print(net) [결과] scpufreq(current=2.. 2022. 11. 24. [Python] QR코드 만들기 qrcode 라이브러리 설치 - pip install qrcode import qrcode qr_data = 'www.naver.com' qr_img = qrcode.make(qr_data) // qrcode.make로 이미지를 만들어 qr_img 변수에 바인딩 save_path = qr_data + '.png' qr_img.save(save_path) // 이미지 저장 2022. 11. 24. [Python] 텍스트를 음성으로 변환 from gtts import gTTS text = "안녕하세요. 파이썬과 40개의 작품들 입니다." tts = gTTS(text=text, lang='ko') tts.save("hi.mp3") gtts 라이브러리 - 문자를 음성으로 변환해주는 라이브러리 2022. 11. 24. [Python] ModuleNotFoundError ex) ModuleNotFoundError: No module named 'requests' 파이썬 유틸리티 pip를 사용하여 추가모듈 (requests)을 설치하면 됨. cmd에서 pip install requests 2022. 11. 23. [Python] 윈도우에서 pip로 설치할 때 '액세스가 거부되었습니다' 해결법 ERROR: Could not install packages due to an OSError: [WinError 5] 액세스가 거부되었습니다: 'c:\\python310\\lib\\site-packages\\pip-22.2.1.dist-info\\entry_points.txt' Consider using the `--user` option or check the permissions. --> 해당 폴더에 적절한 권한이 없어서 발생하는 문제로, 관리자 권한으로 CMD를 실행하면 해결됨. 2022. 11. 23. 이전 1 2 3 4 5 6 7 8 다음