Warning-Could not import the lzma module

/.pyenv/versions/pandas/lib/python3.7/site-packages/pandas/compat/__init__.py:117: UserWarning: Could not import the lzma module. Your installed Python is incomplete. Attempting to use lzma compression will result in a RuntimeError.
  warnings.warn(msg)

.py ํŒŒ์ผ์„ ์‹คํ–‰์‹œ์ผฐ์„ ๋•Œ ๋‹ค์Œ๊ณผ ๊ฐ™์€ warning์ด ๋–ด๋‹ค. stackoverflow์— ์ฐพ์•„๋ณด๋‹ˆ python ์†Œ์Šค์ฝ”๋“œ๋ฅผ ์ปดํŒŒ์ผ ํ•˜๋ ค๋ฉด ๋ฐ˜๋“œ์‹œ liblzma-dev๊ฐ€ ์„ค์น˜๋˜์–ด์žˆ์–ด์•ผํ•œ๋‹ค๊ณ  ํ•œ๋‹ค.

Install liblzma using homebrew

$ brew install xz

xz๋ฅผ ์„ค์น˜ํ•˜๊ณ  ๋‚œ ํ›„์— ๊ธฐ์กด์— ์„ค์น˜ํ•œ pyenv version์„ ์‚ญ์ œ ํ›„ ์žฌ์„ค์น˜ํ•ด์ค˜์•ผํ•œ๋‹ค.

$ pyenv unsinstall 3.7.1
pyenv: remove /Users/jeongdaye/.pyenv/versions/3.7.1? y
$ pyenv install 3.7.1

์„ค์น˜๊ฐ€ ์™„๋ฃŒ๋˜๋ฉด ์•„๋ž˜ ์ฝ”๋“œ๊ฐ€ .zshrc์— ์—†๋‹ค๋ฉด ์ถ”๊ฐ€ํ•ด์ค€๋‹ค.

eval "$(pyenv init -)"
$ source .zshrc

์„ค์น˜ ํ›„ ๋‹ค์‹œ python ๋ช…๋ น์–ด๋ฅผ ์ˆ˜ํ–‰ํ•˜๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์ด warning message์—†์ด ์‹คํ–‰๋˜๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

python serires.py
<class 'pandas.core.series.Series'>


a    11
b     2
c     3
dtype: int64

์ฐธ๊ณ 

Last updated