본문 바로가기
Python notes/Others

파이썬 크롤러) 파이썬 코딩을 위해 pip로 pandas 등 모듈을 깔 때 주의점 !

by 성실한 나무 2018. 12. 17.

왜 자꾸 invalid syntaxError가 뜰까!

라고 하는 분이 있다면...


나와 같은 파이썬 초보일 가능성이 :-).....


pip로 모듈 설치 시 자꾸 까먹는 나의 실수는,

파이썬을 켜놓고 pip3 install 모듈이름을 친다는 것이다 !


파이썬에서 신나게 코딩 연습을 하고 있다가

새로운 모듈을 import해야 한다면,

반드시 exit()으로 나와서


pip3 install pandas 를 쳐주세요 ~ (pip버전이 3.0이전 버전이면 pip만 쳐도 됨)

그리고 관리자실행권한이 필요할 경우에는 맨 앞에 sudo를 붙여서

sudo pip3 install pandas라고 쳐주세요 ~!!



SyntaxError: invalid syntax

>>> sudo pip3 install pandas

  File "<stdin>", line 1

    sudo pip3 install pandas

            ^

SyntaxError: invalid syntax

>>> exit()

gimdonghuiui-iMac:Downloads JJI$ sudo pip3 install pandas

Password:

The directory '/Users/JJI/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

The directory '/Users/JJI/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

Collecting pandas

  Downloading https://files.pythonhosted.org/packages/6b/dc/3a88b7bf8437f3f052fc90de72f28c06248142821a7f108e10ff3be5eb59/pandas-0.23.4-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (14.4MB)

    100% |████████████████████████████████| 14.4MB 4.5MB/s 

Collecting python-dateutil>=2.5.0 (from pandas)

  Downloading https://files.pythonhosted.org/packages/74/68/d87d9b36af36f44254a8d512cbfc48369103a3b9e474be9bdfe536abfc45/python_dateutil-2.7.5-py2.py3-none-any.whl (225kB)

    100% |████████████████████████████████| 235kB 13.6MB/s 

Requirement already satisfied: pytz>=2011k in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from pandas) (2018.7)

Collecting numpy>=1.9.0 (from pandas)

  Downloading https://files.pythonhosted.org/packages/3d/c3/a69406093c9a780a74964f41cd56b06c0346d686a9b3f392d123a663f5e0/numpy-1.15.4-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (24.5MB)

    100% |████████████████████████████████| 24.5MB 2.6MB/s 

Collecting six>=1.5 (from python-dateutil>=2.5.0->pandas)

  Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl

Installing collected packages: six, python-dateutil, numpy, pandas

Successfully installed numpy-1.15.4 pandas-0.23.4 python-dateutil-2.7.5 six-1.12.0

gimdonghuiui-iMac:Downloads JJI$ python3

Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 03:13:28) 

[Clang 6.0 (clang-600.0.57)] on darwin

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

>>> import pandas as pd


댓글