2024년 5월 25일 토요일

pip 버전경고

 pip 는 python 2.x을 위한 것이고 pip3는 python 3.x를 위한 것입니다.

Mac에는 시스템관리를 위하여 기본으로 예전에는 python2이 설치되어 있었습니다.

그러난 맥버전업의 결과 최근에는 python3.8이 기본으로 설치되어 있습니다.

그런데도 pip 명령은 실행됩니다.

~ % pip install numpy
Collecting numpy
Downloading numpy-1.24.4-cp38-cp38-macosx_10_9_x86_64.whl.metadata (5.6 kB)
Downloading numpy-1.24.4-cp38-cp38-macosx_10_9_x86_64.whl (19.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 19.8/19.8 MB 9.1 MB/s eta 0:00:00
Installing collected packages: numpy

pip 와 pip3를 샐행해보면 같은 결과가 나옵니다.

~ % pip list
Package Version
---------- -------
numpy 1.24.4
pip 24.0
setuptools 68.2.2
wheel 0.41.3
~ % pip3 list
Package Version
---------- -------
numpy 1.24.4
pip 24.0
setuptools 68.2.2
wheel 0.41.3

그래서 별의미 없이 pip와 pip3를 혼용하여 사용해왔었는데.

가상환경을 만들어 그곳에서 살펴보니

~/venv310 % cd /Users/venv312
/Users/venv312 % source bin/activate
(venv312) /Users/venv312 % pip list
Package Version
---------- -------
pip 24.0
setuptools 69.5.1
wheel 0.43.0
(venv312) /Users/venv312 % pip3 list
Package Version
------------------------- -----------
....
pillow 10.3.0
pip 21.2.4
pydantic 2.7.1
pydantic_core 2.18.2
pydub 0.25.1
....

pip의 버전이 내용도 틀리고 pip버전이 24.0 과 21.2.4로 차이가 난다.

그리고 끝부분에

WARNING: You are using pip version 21.2.4;
however, version 24.0 is available.
You should consider upgrading via the
'/Library/Developer/CommandLineTools/usr/bin/
python3 -m pip install --upgrade pip' command.

이런 경고화면이 나옵니다.

이를 해결하기위해서는

(venv312) /Users/venv312 % pip3 install --upgrade pip


2024년 5월 17일 금요일

Mac에서 폴더 적용 스크립트를 활용하여 다운받은 파일을 정리하기

 다운로드 폴더에 들어오는 파일을 자동으로 정리하여봅니다.

[Cmd+Space] (=Spotlight) 한다음 스트립트편집기를 엽니다.


새로운 문서 만들기 창에서

사용자 폴더로 이동한다음 [Shift+Cmd+.]을 눌러 숨겨진 항목을 보이게합니다.

Library 폴더로 이동합니다.

Scripts 폴더로 이동합니다. 없으면 [MRB=마우스 오른쪽 버튼]하여 폴더를 생성해줍니다.

Folder Action Scripts 폴더로 이동합니다. 없으면 [MRB]하여 폴더를 생성해줍니다.

화면 아래쪽의 [새로운 폴더]버튼을 선택한 후 아래내용을 붙여넣기 합니다.



on adding folder items to this_folder after receiving added_items
repeat with the_item in added_items
tell application "Finder" to set {fType, nExt} to ({file type, name extension} of file the_item)
set the_folder to (path to downloads folder)
set the_sub_folder to "nil"
if (nExt is "pdf") then --파일의 확장자를 확인함
set the_sub_folder to "documents" --파일이 이동될 폴더의 이름을 설정함.
else if (nExt is "jpg") or (nExt is "jpeg") or (nExt is "png") or (nExt is "bmp") then
set the_sub_folder to "images"
else if (nExt is "dmg") or (nExt is "zip") then
set the_sub_folder to "dmgs"
else if (nExt is "torrent") then
set the_sub_folder to "torrents"
end if
--폴더가 생성이 되어있지 않은경우 폴더 생성함.
if not (the_sub_folder is equal to "nil") then
set the_target to POSIX path of the_folder & the_sub_folder
--for debug
--display dialog the_target
tell application "Finder"
if (exists folder the_sub_folder of the_folder) then
--for debug
--say "폴더 존재함"
else
make new folder at the_folder with properties {name:the_sub_folder}
--say "폴더 생성함"
end if
move the_item to POSIX file the_target with replacing
end tell
end if
end repeat
end adding folder items to

메뉴에서 [파일 > 저장...]한 다음 moveFiles.scpt로 저장해 줍니다.



스크립트 편집기를 종료합니다.
다운로드 폴더로 이동한다음 [MRB]한 후 
[폴더적용 스크립트 설정..]에서
방금전에 생성한 파일(moveFiles.scpt)를 선택합니다.
서비스 확인창이 뜨면 서비스실행을 선택합니다.

폴더적용 스크립트 창을 닫고 pdf, dmg, torrent등의 파일을 다른폴더에서 이동시키거나, 인터넷에서 파일을 다운받으면 파일이 자동으로 정리됩니다.







vscode 에서 파이썬 가상환경을 .venv 를 만들면 새로운 터미널을 생성하면 ((.venv) ) 로 표시된는 것 해결

 vscode 에서 파이썬 가상환경을 .venv 를 만들면 새로운 터미널을 생성하면 ((.venv) ) 로 표시 즉 /Volumes/jglee/AI&Python/lottoly45 % source .venv/bin/activate ((.venv)...