어떤 코드를 보고 따라할 때, 텐서플로우가 버전이 계속 업데이트 되고, 이에 따라 코드가 조금씩 바뀌어서 따라하기 어렵더라구요. 이럴 때 버전을 확인하고 변경해줄 때도 필요하고, 업데이트할 일도 있는데 이때 참고!
import tensorflow as tf
print(tf.__version__)
# cpu일 때, 원하는 버전으로 설정
pip install --upgrade tensorflow==2.7.0
#gpu일 때
pip install --upgrade tensorflow-gpu==2.7.0
시작부터 데이터를 못 열면 안되겠죠? 하하핳
import os
os.startfile('nlp')
path= os.getcwd()
print(path)
# 현재 위치에서 한단계 내려가기 (폴더 개수만큼 ../추가해서 이전경로로 변경할 수 있다.)
os.chdir("../")
path= os.getcwd()
print(path)
# 현재 위치에서 한단계 내려가기 (폴더 개수만큼 ../추가해서 이전경로로 변경할 수 있다.)
os.listdir()
os.rename("C:/Users/destop/nlp.py","C:/Users/destop/textmining.py")
# 경로, 파일명, 확장자까지 같이 변경해야함!
path, file=os.path.split("C:/Users/destop/nlp.py")
print(path)
# C:/Users/destop
print(file)
# nlp.py
#경로 합치는 방법은 split말고 join 사용해서 ("","")로 묶기!
# 파일이름과 확장자 분리하는 방법은 os.path.splitext