티스토리 뷰


기본 맥북에 설치된 파이썬 2 버전이 아닌 3버전을 이용하기 위해서 파이썬3 버전을 설치를 시도했고 


Error: An unexpected error occurred during the `brew link` step


위와 같은 에러 메세지를 만나게 되었다. 


구글링을 해보니...


https://github.com/jakubroztocil/httpie/issues/645


해당 링크에 이미 깃헙 이슈가 있었다. 


설치 에러가 발생한 직후 brew doctor 명령어를 이용해보니 아래와 같은 방법을 알려주었다.


Please note that these warnings are just used to help the Homebrew maintainers

with debugging if you file an issue. If everything you use Homebrew for is

working fine: please don't worry or file an issue; just ignore this. Thanks!


Warning: The following directories do not exist:

/usr/local/sbin


You should create these directories and change their ownership to your account.

  sudo mkdir -p /usr/local/sbin

  sudo chown -R $(whoami) /usr/local/sbin


Warning: You have unlinked kegs in your Cellar

Leaving kegs unlinked can lead to build-trouble and cause brews that depend on

those kegs to fail to run properly once built. Run `brew link` on these:

  python


이렇게해보니 아래와 같은 에러가 또 발생한다.


Error: An unexpected error occurred during the `brew link` step

The formula built, but is not symlinked into /usr/local

Permission denied @ dir_s_mkdir - /usr/local/Frameworks/Python.framework

Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks/Python.framework


또 brew doctor를 해보았다.


HyungJuui-MacBook-Pro:key nhj7$ brew doctor

Please note that these warnings are just used to help the Homebrew maintainers

with debugging if you file an issue. If everything you use Homebrew for is

working fine: please don't worry or file an issue; just ignore this. Thanks!


Warning: You have unlinked kegs in your Cellar

Leaving kegs unlinked can lead to build-trouble and cause brews that depend on

those kegs to fail to run properly once built. Run `brew link` on these:

  python


brew link python 을 해보았다. 


HyungJuui-MacBook-Pro:key nhj7$ brew link python

Linking /usr/local/Cellar/python/3.7.2_2... Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks/Python.framework

HyungJuui-MacBook-Pro:key nhj7$ cd /usr/local/Frameworks/


저 폴더를 local 밑에 만들어주고 chown 으로 권한을 줘야 제대로 동작할 것 같아서 그대로 해보았다.


HyungJuui-MacBook-Pro:local nhj7$ sudo chown -R $(whoami) /usr/local/Frameworks/


HyungJuui-MacBook-Pro:local nhj7$ python3

Python 3.7.2 (default, Mar 10 2019, 00:10:56) 

[Clang 10.0.0 (clang-1000.11.45.5)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

>>> 

>>> 

>>> exit

Use exit() or Ctrl-D (i.e. EOF) to exit


이제 성공했다. 


그냥 python을 쓰거나 기타 툴에서도 파이썬3을 쓰기 위해서 bash_profile에 등록시켜주었다. 


vi ~/bash_profile


alias python='python3' <= 요 내용을 추가한 뒤 저장하고 닫는다. 


source ~/bash_profile <=프로파일을 다시 인식시켜준 뒤에... 


python -V로 확인해보니 파이썬3으로 잘 실행된다. ㅎㅎ


파이썬 3 설치 끝. 




'dev > python' 카테고리의 다른 글

파이썬 Django vs Flask 비교(장단점)  (0) 2019.10.14

댓글
최근에 올라온 글
최근에 달린 댓글