์๋
ํ์ธ์,
๋๋ ipykernel ์์ ์ปค๋์ ๋ง๋๋ ์์ ํ๋ก์ ํธ์ ๊ธฐ์ฌํ๊ณ ์์ต๋๋ค. ๋ง์ง์ง ๊ฝค ๋์๋๋ฐ ์ค๋ Jupyter๋ฅผ ์ค์นํ์ฌ ์๋ก์ด ๊ฐ๋ฐ ํ๊ฒฝ์ ๋ฐฐํฌํ์ ๋ ipykernel์ ํธ์ถํ ๋ ๋ค์๊ณผ ๊ฐ์ ์คํ ์ถ์ ์ ์ป์์ต๋๋ค.
File "<path to python>/lib/python2.7/site-packages/ipykernel-4.3.1-py2.7.egg/ipykernel/__init__.py", line 2, in <module>
from .connect import *
File "<path to python>/lib/python2.7/site-packages/ipykernel-4.3.1-py2.7.egg/ipykernel/connect.py", line 13, in <module>
from IPython.core.profiledir import ProfileDir
File "<path to python>/lib/python2.7/site-packages/ipython-5.0.0b4-py2.7.egg/IPython/__init__.py", line 48, in <module>
from .core.application import Application
File "<path to python>/lib/python2.7/site-packages/ipython-5.0.0b4-py2.7.egg/IPython/core/application.py", line 24, in <module>
from IPython.core import release, crashhandler
File "<path to python>/lib/python2.7/site-packages/ipython-5.0.0b4-py2.7.egg/IPython/core/crashhandler.py", line 28, in <module>
from IPython.core import ultratb
File "<path to python>/lib/python2.7/site-packages/ipython-5.0.0b4-py2.7.egg/IPython/core/ultratb.py", line 126, in <module>
from IPython.utils.terminal import get_terminal_size
File "<path to python>/lib/python2.7/site-packages/ipython-5.0.0b4-py2.7.egg/IPython/utils/terminal.py", line 22, in <module>
from backports.shutil_get_terminal_size import get_terminal_size as _get_terminal_size
ImportError: No module named shutil_get_terminal_size
๋ถ๋ช ํ IPython๊ณผ ipykernel์ ๋ง์ง๋ง์ผ๋ก ์ฌ์ฉํ ์ดํ๋ก ๋ฌด์ธ๊ฐ๊ฐ ๋ณ๊ฒฝ๋์์ต๋๋ค. ๋ฌธ์ ๊ฐ ๋ญ์ง ์์ธ์? ์ ๋ Python 2.7.10์ด ์๋ OSX ์์์์ ์์ ํ๊ณ ์์ต๋๋ค.
๋ฒ ์คํธ, ์์ฐ๋ ๋ฆฌ์
์ด๋ป๊ฒ ๋ ์ข
์์ฑ์ ์ป์ง ์๊ณ IPython์ ์ค์น ํ ๊ฒ ๊ฐ์ต๋๋ค. ๋ด๊ฐ ์์ ๋ณธ ๊ฒ์ ๊ฐ์ํ ๋ ์ด๊ฒ์ ์๋ง๋ ๋๋ฌด ์ค๋๋ ๋ฒ์ ์ setuptools๋ฅผ ๊ฐ์ง๊ณ ์๊ณ easy_install
ํฉ๋๋ค. ๋จผ์ ๋น๊ต์ ์ต๊ทผ์ pip/setuptools๊ฐ ์๋์ง ํ์ธํ์ญ์์ค.
pip install --upgrade setuptools pip
๊ทธ๋ฐ ๋ค์, pip๋ฅผ ์ฌ์ฉํ์ฌ IPython์ ๋ค์ ์ค์นํด ๋ณด์ญ์์ค(pip๊ฐ ์๋ํ์ง ์๊ฑฐ๋ ์๋ํ์ง ์๋ ํฉ๋นํ ์ด์ ๊ฐ ์๋ค๋ ๊ฒ์ ์์ง ๋ชปํ๋ ํ easy_install์ ์ฌ์ฉํ์ง ๋ง์ญ์์ค. ์ด๋ฌํ ๊ฒฝ์ฐ๋ ๋๋ญ ๋๋ค):
pip uninstall ipython
pip install ipython
ํนํ ์ด ๊ฒฝ์ฐ backports.shutil_get_terminal_size ํจํค์ง์ ๋ํ ์ข ์์ฑ์ ์ถ๊ฐํ์ต๋๋ค.
๋น ๋ฅธ ํผ๋๋ฐฑ ๊ฐ์ฌํฉ๋๋ค! ๊ทธ๋ฌ๋ ๋ฏธ์คํฐ๋ฆฌ๋ ๊น์ด์ง๋ค. ๋ช ๋ น์ค์์ pip ๋ฅผ ํตํด Jupyter๋ฅผ ์ค์นํ๋ฉด setuptools๋ฅผ ์ฌ์ฉํ ๋ Jupyter๋ฅผ ์๊ตฌ ์ฌํญ์ผ๋ก ์ค์ ํ๋ ๊ฒ๊ณผ ๋ค๋ฅธ ๊ฒฐ๊ณผ๊ฐ ๋์ค๋ ๊ฒ์ฒ๋ผ ๋ณด์ ๋๋ค. ์ฒซ ๋ฒ์งธ ์ ๊ทผ ๋ฐฉ์์ ์ฑ๊ณตํ์ง๋ง ๋ ๋ฒ์งธ ์ ๊ทผ ๋ฐฉ์์ ์คํจํฉ๋๋ค. ์ด ๋ฌธ์ ๋ฅผ ์ฌํํ๋ ๋จ๊ณ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
๋จผ์ 3๊ฐ์ ํจํค์ง๋ง ์ค์น๋ ๋ฒ ์ด๋ณธ Python 2.7.11 ์ธํฐํ๋ฆฌํฐ๋ก ์์ํฉ๋๋ค.
$ pip list
pip (8.1.2)
setuptools (23.1.0)
virtualenv (15.0.2)
pip๋ฅผ ์ฌ์ฉํ์ฌ Jupyter๋ฅผ ์ค์นํ๋ฉด ๋ชจ๋ ๊ฒ์ด ์ ๋๋ก ์๋ํ๊ณ ๋ค์ ํจํค์ง๋ฅผ ์ป์ต๋๋ค.
$ pip install jupyter
<long output>
$ pip list
appnope (0.1.0)
backports-abc (0.4)
backports.shutil-get-terminal-size (1.0.0)
backports.ssl-match-hostname (3.5.0.1)
certifi (2016.2.28)
configparser (3.5.0)
decorator (4.0.10)
entrypoints (0.2.2)
functools32 (3.2.3.post2)
gnureadline (6.3.3)
ipykernel (4.3.1)
ipython (4.2.0)
ipython-genutils (0.1.0)
ipywidgets (5.1.5)
Jinja2 (2.8)
jsonschema (2.5.1)
jupyter (1.0.0)
jupyter-client (4.3.0)
jupyter-console (4.1.1)
jupyter-core (4.1.0)
MarkupSafe (0.23)
mistune (0.7.2)
nbconvert (4.2.0)
nbformat (4.0.1)
notebook (4.2.1)
pathlib2 (2.1.0)
pexpect (4.1.0)
pickleshare (0.7.2)
pip (8.1.2)
ptyprocess (0.5.1)
Pygments (2.1.3)
pyzmq (15.2.0)
qtconsole (4.2.1)
setuptools (23.1.0)
simplegeneric (0.8.1)
singledispatch (3.4.0.3)
six (1.10.0)
terminado (0.6)
tornado (4.3)
traitlets (4.2.1)
wheel (0.29.0)
widgetsnbextension (1.2.3)
๊ทธ๋ฌ๋ ๋ค์ setup.py
์คํฌ๋ฆฝํธ๋ฅผ ์ฌ์ฉํ์ฌ ํ๋ก์ ํธ์ ์๊ตฌ ์ฌํญ์ผ๋ก Jupyter๋ฅผ ์ค์นํ๋ ค๊ณ ํ๋ฉด(์ธ ๊ฐ์ง ๊ธฐ๋ณธ ๋ชจ๋ pip
, setuptools
๊ฐ ์๋ ์๋ก์ด 2.7.11 ์ธํฐํ๋ฆฌํฐ์์ ๋ค์ ์์ํฉ๋๋ค. virtualenv
):
#!/usr/bin/env python
import setuptools
setuptools.setup(
...
install_requires = [
"jupyter"],
...
... ๊ทธ๋ฌ๋ฉด ์คํจํฉ๋๋ค.
$ pip list
pip (8.1.2)
setuptools (23.1.0)
virtualenv (15.0.2)
$ ./setup.py install
<long output>
Searching for entrypoints
Reading https://pypi.python.org/simple/entrypoints/
No local packages or download links found for entrypoints
error: Could not find suitable distribution for Requirement.parse('entrypoints')
make: *** [install] Error 1
ํฅ๋ฏธ๋กญ๊ฒ๋ _did_ ์ค์นํ ํจํค์ง๋ฅผ ๋์ดํ ๋ ipython
๋ฐ jupyter-console
๊ฐ ์์ ๊ฐ์ด 4.2.0 ๋ฐ 4.1.1 ๋์ ๊ฐ๊ฐ ๋ฒ์ 5.0.0b4 ๋ฐ 5.0.0b1์์ ์ ์ ์์ต๋๋ค. pip ๋ก Jupyter๋ฅผ ์ค์นํ ๋ ํจํค์ง๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
$ pip list
ipykernel (4.3.1)
ipython (5.0.0b4)
ipywidgets (5.1.5)
jupyter (1.0.0)
jupyter-client (4.3.0)
jupyter-console (5.0.0b1)
nbconvert (4.2.0)
notebook (4.2.1)
pip (8.1.2)
qtconsole (4.2.1)
setuptools (23.1.0)
tornado (4.3)
traitlets (4.2.1)
wheel (0.29.0)
widgetsnbextension (1.2.3)
์ฌ๊ธฐ์์ ๋๋ฝ๋ ๊ฒ์ด ์์ ์ ์์ง๋ง ๋ฌด์์ธ์ง ์ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค. setuptools -powered setup.py
์คํฌ๋ฆฝํธ์์ jupyter
๋ฅผ ์ข
์์ฑ์ผ๋ก ์ฌ์ฉํ๋ ๋ฐ ์คํจํ๋ ์ด์ ๊ฐ ๋ฌด์์
๋๊น?
์ต์์,
์์ฐ๋ ๋ฆฌ์
์ด๋ ์๋ง๋ setuptools๊ฐ ๊ฐ์ ธ์ฌ ๋ pip๊ฐ ๋์ดํ๋ ๊ฒ๊ณผ ๋ค๋ฅธ ๋ฒ์ ์ ์ป๊ณ ์์์ ๋ํ๋ ๋๋ค(์ด์ setuptools๋ก ์ธํ ์๋ ค์ง ๋ฒ๊ทธ). ๋ฌด์์ ์ป์ ์ ์์ต๋๊น?
python -c 'import setuptools; print(setuptools, setuptools.__version__)'
๊ทธ๋ฆฌ๊ณ ๋ํ:
python -m site
๋ํ setup.py์์ setuptools๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ python setup.py install
ํ์ง ์๊ณ pip install .
๋ง ์ํํด์ผ ํ๋ค๋ ์ฌ์ค์ด ์ต์ํ์ง ์์ ์๋ ์์ต๋๋ค.
์ถ๋ ฅ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
$ python -c 'import setuptools; print(setuptools, setuptools.__version__)'
(<module 'setuptools' from '/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/setuptools/__init__.pyc'>, '23.1.0')
๊ทธ๋ฆฌ๊ณ
$ python -m site
sys.path = [
'/Users/ajmazurie/Data/Professional-MSU/2015.07-MSU-me-Jupyter_in_Classroom/Projects/Callysto/callysto',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/jupyter-1.0.0-py2.7.egg',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/ipywidgets-5.1.5-py2.7.egg',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/ipykernel-4.3.1-py2.7.egg',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/nbconvert-4.2.0-py2.7.egg',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/jupyter_console-5.0.0b1-py2.7.egg',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/qtconsole-4.2.1-py2.7.egg',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/notebook-4.2.1-py2.7.egg',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/widgetsnbextension-1.2.3-py2.7.egg',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/traitlets-4.2.1-py2.7.egg',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/ipython-5.0.0b4-py2.7.egg',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/tornado-4.3-py2.7-macosx-10.10-x86_64.egg',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/jupyter_client-4.3.0-py2.7.egg',
'/Users/ajmazurie/<path to python>/lib/python27.zip',
'/Users/ajmazurie/<path to python>/lib/python2.7',
'/Users/ajmazurie/<path to python>/lib/python2.7/plat-darwin',
'/Users/ajmazurie/<path to python>/lib/python2.7/plat-mac',
'/Users/ajmazurie/<path to python>/lib/python2.7/plat-mac/lib-scriptpackages',
'/Users/ajmazurie/<path to python>/lib/python2.7/lib-tk',
'/Users/ajmazurie/<path to python>/lib/python2.7/lib-old',
'/Users/ajmazurie/<path to python>/lib/python2.7/lib-dynload',
'/Users/ajmazurie/.direnv/pyenv/versions/2.7.11/lib/python2.7',
'/Users/ajmazurie/.direnv/pyenv/versions/2.7.11/lib/python2.7/plat-darwin',
'/Users/ajmazurie/.direnv/pyenv/versions/2.7.11/lib/python2.7/lib-tk',
'/Users/ajmazurie/.direnv/pyenv/versions/2.7.11/lib/python2.7/plat-mac',
'/Users/ajmazurie/.direnv/pyenv/versions/2.7.11/lib/python2.7/plat-mac/lib-scriptpackages',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages',
]
USER_BASE: '/Users/ajmazurie/.local' (doesn't exist)
USER_SITE: '/Users/ajmazurie/.local/lib/python2.7/site-packages' (doesn't exist)
ENABLE_USER_SITE: False
๋ํ setup.py์์ setuptools๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ
python setup.py install
ํ์ง ๋ง๊ณpip install .
๋ง ์ํํด์ผ ํ๋ค๋ ์ฌ์ค์ด ์ต์ํ์ง ์์ ์๋ ์์ต๋๋ค.
์ด๊ฒ์ ๋งค์ฐ ํฅ๋ฏธ๋กญ๊ณ setuptools์ ๋ํ ์ง์์ ์
๋ฐ์ดํธํด์ผ ํ๋ค๋ ์ ํธ์ผ ์ ์์ต๋๋ค. ์ด์จ๋ ์ด๊ฒ์ ๋ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ต๋๋ค! ์์ setup.py
์คํฌ๋ฆฝํธ๊ฐ ํฌํจ๋ ํด๋์ pip install .
๋ฅผ ์
๋ ฅํ์ฌ Jupyter์ ํด๋น ์ข
์์ฑ์ ์ฑ๊ณต์ ์ผ๋ก ์ค์นํ ์ ์์์ต๋๋ค. ๊ฐ์ฌ ํด์!
๋ถ์์ ์ธ ์ง๋ฌธ์ผ๋ก python setup.py install
์๋ํ์ง ์๋ ์ด์ ๋ ๋ฌด์์
๋๊น? ์ด๊ฒ์ด ์ ๋ฌธ์ ๊ฐ ๋ ์ ์๋์ง์ ๋ํ ์จ๋ผ์ธ ์ฐธ์กฐ๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.
๋ฒ ์คํธ, ์์ฐ๋ ๋ฆฌ์
python setup.py install
๋ easy_install๊ณผ ๋์ผํ ์์
์ ์ํํฉ๋๋ค. easy_install์ ๋ง์ ๋ถ์พํ ์ผ์ ํฉ๋๋ค. ์ด๊ฒ์ด pip๊ฐ ์์ฑ๋ ์ด์ ์
๋๋ค. ์ด์ ๋ฒ์ ๊ณผ์ ํธํ์ฑ์ ์ํด ๊ฐ์ ธ์จ setuptools๊ฐ ์๋ python setup.py install
๋ ํญ์ easy_install
๊ฐ ํ๋ ๋ฐ๋์งํ์ง ์์ ์์
์ ์ํํ๋ฏ๋ก ํธ์ถํด์๋ ์ ๋ฉ๋๋ค.
NFS์์ ๊ณต์ ๋๋ virtualvenv์ ipython์ ์ค์นํ๋ ๊ฒฝ์ฐ์๋ง ์ด ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค. NFS์ venv์ ์ค์นํ๋ฉด ์ด ๋ฌธ์ ๊ฐ ๋ฐ์ํ ์ ์๋ ๋จ์๊ฐ ์์ต๋๊น?
NFS๊ฐ ์ฐจ์ด๋ฅผ ๋ง๋๋ ์ด์ ๋ ํ์คํ์ง ์์ง๋ง virtualenv ๋ด๋ถ์ pip ๋ฒ์ ์ ํ์ธํ๊ณ ์ต์ ๋ฒ์ ์ด ์๋ ๊ฒฝ์ฐ ์ ๋ฐ์ดํธํด ๋ณด์ญ์์ค.
pip install --upgrade setuptools pip
@takluyver "์ผ๋ฐ" ํ์ผ ์์คํ ์ ipython์ ์ ์ค์นํ๋ ๋์ผํ pip๊ฐ NFS์ ์ ๋๋ก ์ค์น๋์ง ์์ต๋๋ค. ๊ทธ๋ฆฌ๊ณ ์, ์ต์ ๋ฒ์ ์ pip์ ๋๋ค.
๊ธฐ๊ดดํ. NFS๊ฐ ์ ์ํฅ์ ๋ฏธ์น๋์ง ์ ํ ๋ชจ๋ฆ ๋๋ค.
๋ํ ์ต์ pip
(8.1.2) ๋ฐ ์ต์ setuptools
(25.1.6)์ ์ฌ์ฉํ๋ Python 2.7์์ ์ด ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค. ๋ญ๊ฐ ๋ ์งํ๋๊ณ ์๋ ๊ฒ์ ๋ถ๊ฐ๋ฅํฉ๋๊น?
๋ฏธ๋ฆฌ pip
์ ํจ๊ป backports.shutil_get_terminal_size
๋ฅผ ์ค์นํ๋ ๊ฒ์ด ๋ฌธ์ ์ ๋ํ ํจ๊ณผ์ ์ธ ํด๊ฒฐ ๋ฐฉ๋ฒ์ด์์ต๋๋ค.
๋ค๋ฅธ ๊ณณ์์ ์ธ๊ธํ๋ฏ์ด PR( https://github.com/paulgb/runipy/pull/125 )์ ํจ๊ป ๋ฃ์ด backports.shutil_get_terminal_size
์ค๋ฅ์ entrypoints
์ค๋ฅ๋ฅผ ํ์ํฉ๋๋ค. ์ฒซ ๋ฒ์งธ ์ปค๋ฐ์ ์ฒซ ๋ฒ์งธ ์ค๋ฅ๋ฅผ ๋ณด์ฌ์ฃผ๊ณ ๋ ๋ฒ์งธ ์ปค๋ฐ์ ๋ ๋ฒ์งธ ์ค๋ฅ๋ฅผ ๋ณด์ฌ์ค๋๋ค. ๋ ๊ฒฝ์ฐ ๋ชจ๋ ๋งคํธ๋ฆญ์ค์ ์ฒ์ 3๊ฐ CI ๋น๋๊ฐ ์ค์ํฉ๋๋ค. ์ด 3๊ฐ์ง ๋ชจ๋ setuptools
๋ฅผ ์ฌ์ฉํ์ฌ ๋ชจ๋ ๊ฒ์ ์ค์นํฉ๋๋ค.
setuptools์ ๋ฌธ์ ๊ฐ ์๋ ๊ฒ ๊ฐ์ต๋๋ค. pip๋ฅผ ์ฌ์ฉํ์ฌ ์ค์นํ๋ฉด(ํญ์ ์ํํด์ผ ํ๋ ๊ฒ์ฒ๋ผ) ๋ฌธ์ ๊ฐ
ํ์ง๋ง setuptools๊ฐ ์ด๋ค ์์ ์ ์ํํ์ง ๋ชปํ๋์ง 100% ํ์ ํ ์ ์์ต๋๋ค.
๋๋ ์๋ก์ด 2.7.3 virtualenv์ IPython(Jupyter ์๋)์ ์ค์นํ๋ ๊ฒ๊ณผ ๊ฐ์ ์ข
๋ฅ์ ๋ฌธ์ ๋ฅผ ๊ฒช์์ต๋๋ค. IPython์ด ์ค์น๋๋ ๊ฒ์ฒ๋ผ ๋ณด์ด์ง๋ง pathlib2
๋ฐ backports.shutil-get-terminal-size
์ด ๋๋ฝ๋์์ต๋๋ค. ๊ฐ๊ฐ์ ๋ํด pip install
๋ฅผ ์ํํ๋ฉด ์ข
์์ฑ์ด ์์ ๋๊ณ IPython์ด ์ด์ ์๋ํฉ๋๋ค.
$ pip freeze
nose==1.3.7
numpy==1.8.0
pyreadline==2.1
wsgiref==0.1.2
$ pip install ipython
[...]
Successfully installed ipython setuptools decorator pickleshare simplegeneric traitlets prompt-toolkit pygments pexpect ipython-genutils six wcwidth ptyprocess
Cleaning up...
$ pip freeze
Pygments==2.1.3
decorator==4.0.10
ipython==5.0.0
ipython-genutils==0.1.0
nose==1.3.7
numpy==1.8.0
pexpect==4.2.0
pickleshare==0.7.3
prompt-toolkit==1.0.5
ptyprocess==0.5.1
pyreadline==2.1
simplegeneric==0.8.1
six==1.10.0
traitlets==4.2.2
wcwidth==0.1.7
wsgiref==0.1.2
$ ipython
[...]
pkg_resources.DistributionNotFound: The 'pathlib2' distribution was not found and is required by ipython
$ pip install pathlib2
$ ipython
[...]
pkg_resources.DistributionNotFound: The 'backports.shutil_get_terminal_size' distribution was not found and is required by ipython
$ pip install backports.shutil_get_terminal_size
$ pip freeze
Pygments==2.1.3
backports.shutil-get-terminal-size==1.0.0
decorator==4.0.10
ipython==5.0.0
ipython-genutils==0.1.0
nose==1.3.7
numpy==1.8.0
pathlib2==2.1.0
pexpect==4.2.0
pickleshare==0.7.3
prompt-toolkit==1.0.5
ptyprocess==0.5.1
pyreadline==2.1
simplegeneric==0.8.1
six==1.10.0
traitlets==4.2.2
wcwidth==0.1.7
wsgiref==0.1.2
$ ipython
Python 2.7.3 (default, Aug 11 2016, 11:06:04)
Type "copyright", "credits" or "license" for more information.
IPython 5.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]:
pip --version
์์ต๋๊น? ๋๋ ๋น์ ์ด ๋๋ฌด ์ค๋๋ ๋ฒ์ ์ pip๋ฅผ ๊ฐ์ง๊ณ ์๋ค๊ณ ์๊ฐํฉ๋๋ค.
๊ทธ๋ ๋๊ฐ ์ณ์. ๋๋ ํ 1.4.1์ ์์๋ค.
virtualenv๋ฅผ pip 8.1.2๋ก ์ ๊ทธ๋ ์ด๋ํ๊ณ IPython 5.0.0์ ๋ฌธ์ ์์ด ์ค์นํ ํ ์ฐ์ต์ ๋ฐ๋ณตํ์ต๋๋ค.
$ pip freeze
backports.shutil-get-terminal-size==1.0.0
decorator==4.0.10
ipython==5.0.0
ipython-genutils==0.1.0
numpy==1.8.0
pathlib2==2.1.0
pexpect==4.2.0
pickleshare==0.7.3
prompt-toolkit==1.0.5
ptyprocess==0.5.1
Pygments==2.1.3
simplegeneric==0.8.1
six==1.10.0
traitlets==4.2.2
wcwidth==0.1.7
OS X์์๋ ์ด ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค.
cternus<strong i="6">@astarael</strong>:~โซ ipython
Traceback (most recent call last):
File "/usr/local/bin/ipython", line 7, in <module>
from IPython import start_ipython
File "/usr/local/lib/python2.7/site-packages/IPython/__init__.py", line 48, in <module>
from .core.application import Application
File "/usr/local/lib/python2.7/site-packages/IPython/core/application.py", line 25, in <module>
from IPython.core import release, crashhandler
File "/usr/local/lib/python2.7/site-packages/IPython/core/crashhandler.py", line 28, in <module>
from IPython.core import ultratb
File "/usr/local/lib/python2.7/site-packages/IPython/core/ultratb.py", line 128, in <module>
from IPython.utils.terminal import get_terminal_size
File "/usr/local/lib/python2.7/site-packages/IPython/utils/terminal.py", line 22, in <module>
from backports.shutil_get_terminal_size import get_terminal_size as _get_terminal_size
ImportError: No module named shutil_get_terminal_size
cternus<strong i="7">@astarael</strong>:~โซ pip freeze | grep shutil
backports.shutil-get-terminal-size==1.0.0
cternus<strong i="8">@astarael</strong>:~โซ pip freeze | grep ipython
ipython==5.0.0
ipython-genutils==0.1.0
cternus<strong i="9">@astarael</strong>:~โซ python -m site
sys.path = [
'/Users/cternus',
'/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
'/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
'/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
'/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
'/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
'/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/site-packages',
'/Library/Python/2.7/site-packages',
'/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages',
]
USER_BASE: '/Users/cternus/Library/Python/2.7' (doesn't exist)
USER_SITE: '/Users/cternus/Library/Python/2.7/lib/python/site-packages' (doesn't exist)
ENABLE_USER_SITE: True
๋๋ ์ด์์ด sudo pip install --upgrade --force-reinstall ipython
(pip ๋ฐ setuptools ์ฌ์ค์น)๋ฅผ ์๋ํ์ต๋๋ค.
์กฐ์ฌํ ๊ฒฐ๊ณผ backports.shutil_get_terminal_size
๋ชจ๋ ์์ฒด์ ๊ฒฐํจ์ด ์๋ค๊ณ ์๊ฐํฉ๋๋ค.
cternus<strong i="7">@astarael</strong>:/usr/local/lib/python2.7/site-packagesโซ python
Python 2.7.12 (default, Jun 29 2016, 14:05:02)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import backports
>>> dir(backports)
['__doc__', '__name__', '__path__']
>>> import backports.shutil_get_terminal_size
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named shutil_get_terminal_size
>>>
cternus<strong i="8">@astarael</strong>:/usr/local/lib/python2.7/site-packagesโซ ls backports
__init__.py functools_lru_cache.py shutil_get_terminal_size
cternus<strong i="9">@astarael</strong>:/usr/local/lib/python2.7/site-packagesโซ ls backports/shutil_get_terminal_size
__init__.py __init__.pyc get_terminal_size.py get_terminal_size.pyc
cternus<strong i="10">@astarael</strong>:/usr/local/lib/python2.7/site-packagesโซ
ํฅ๋ฏธ๋กญ๊ฒ๋ backports
๋ชจ๋์ ๋ ๊ฐ์ง(์ฝ๊ฐ ๋ค๋ฅธ?!) ๋ฒ์ ์ ์ค์นํ๋ ๊ฒ ๊ฐ์ต๋๋ค.
root<strong i="15">@astarael</strong>:/usr/local/lib/python2.7/site-packages/backportsโซ pip show --no-cache -vf backports.shutil-get-terminal-size
---
Metadata-Version: 2.0
Name: backports.shutil-get-terminal-size
Version: 1.0.0
Summary: A backport of the get_terminal_size function from Python 3.3's shutil.
Home-page: https://github.com/chrippa/backports.shutil_get_terminal_size
Author: Christopher Rosell
Author-email: [email protected]
Installer: pip
License: MIT
Location: /usr/local/lib/python2.7/site-packages
Requires:
Classifiers:
Development Status :: 5 - Production/Stable
License :: OSI Approved :: MIT License
Programming Language :: Python :: 2.6
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3.2
Files:
backports.shutil_get_terminal_size-1.0.0.dist-info/DESCRIPTION.rst
backports.shutil_get_terminal_size-1.0.0.dist-info/INSTALLER
backports.shutil_get_terminal_size-1.0.0.dist-info/METADATA
backports.shutil_get_terminal_size-1.0.0.dist-info/RECORD
backports.shutil_get_terminal_size-1.0.0.dist-info/WHEEL
backports.shutil_get_terminal_size-1.0.0.dist-info/metadata.json
backports.shutil_get_terminal_size-1.0.0.dist-info/top_level.txt
backports/__init__.py
backports/__init__.pyc
backports/shutil_get_terminal_size/__init__.py
backports/shutil_get_terminal_size/__init__.pyc
backports/shutil_get_terminal_size/get_terminal_size.py
backports/shutil_get_terminal_size/get_terminal_size.pyc
shutil_backports/__init__.py
shutil_backports/__init__.pyc
shutil_backports/get_terminal_size.py
shutil_backports/get_terminal_size.pyc
๊ทธ๋ฆฌ๊ณ shutil_backports.get_terminal_size๋ฅผ ์ฌ์ฉํ๋๋ก IPython/utils/terminal.py๋ฅผ ํจ์นํ๋ฉด ์๋ํฉ๋๋ค. ๊ทธ๋ฆผ์ ์ด๋.
์๋ ํ์ญ๋๊น,
virtualenv์์ ๋์ผํ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค. pip๋ฅผ ์ฌ์ฉํ์ฌ jupyter๋ฅผ ์ค์นํ์ต๋๋ค.
๋๋ ์ป๊ณ ์์๋ค
ImportError: shutil_get_terminal_size๋ผ๋ ๋ชจ๋์ด ์์ต๋๋ค.
_"pip freeze"๋ backports.shutil-get-terminal-size==1.0.0_์ ํ์ํ์ต๋๋ค.
๊ทธ๋์ ์ ๊ทธ๋ ์ด๋๋ฅผ ์๋ํ์ต๋๋ค. ๊ทธ๊ฒ์ ๋ณด์ฌ์ฃผ์๋ค:
_pip ์ค์น --upgrade backports.shutil-get-terminal-size_
์๊ตฌ ์ฌํญ์ด ์ด๋ฏธ ์ต์ ์ํ์
๋๋ค. /Library/Python/2.7/site-packages์ backports.shutil-get-terminal-size
๊ทธ๋์ ์ด๋ป๊ฒ ๋ ๋ด ๊ธ๋ก๋ฒ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ก์ธ์คํ๊ณ ๋ด venv์ ์๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ์๋ ์ก์ธ์คํ์ต๋๋ค.
๊ทธ๋ฐ ๋ค์ ์ ์ญ python์์ backports.shutil-get-terminal-size๋ฅผ ์ ๊ฑฐํ๊ณ ๋ด veev์ ์ค์นํ์ต๋๋ค. ์ด์ ์ ์๋ํฉ๋๋ค.
์ด ์ค์น๋ก 100% ์ฌํํ ์ ์์ต๋๋ค.
pip install --user --upgrade ipython==4.2
์ด ์ค์น๋ก 0%์ ์๊ฐ์ ์ฌํํ ์ ์์ต๋๋ค.
pip install --user --upgrade ipython==4.1.1
--user
๋ช
๋ น์ค python ๋๊ตฌ๋ ~/Library/Python/2.7/bin/ipython
๋์ /usr/local/bin
@AndrewHoos ์ ๋๋ฅผ ์ํด ๋ ๋ช
๋ น ๋ชจ๋ ์ข
์์ฑ์ ์ฌ๋ฐ๋ฅด๊ฒ ๊ฐ์ ธ์ต๋๋ค. pip --version
์์ ๋ฌด์์ ์ป์ ์ ์์ต๋๊น? ์ต์ 8์ด์ด์ผ ํฉ๋๋ค. ๊ทธ๋ ์ง ์์ ๊ฒฝ์ฐ setuptools์ pip๊ฐ ์ต์ ์ํ์ธ์ง ํ์ธํ์ญ์์ค.
pip install --upgrade setuptools pip
conda
์ ํจ๊ป ์ค์น๋ ๋
ธํธ๋ถ 4.2.2 ๋ฐ ipython 5.1.0์์ ์ด ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ต๋๋ค. ์์์ ์ธ๊ธํ๋ฏ์ด shutil_get_terminal_size
์ด๋ฏธ ์ค์น๋์ด ์์ต๋๋ค.
pip install backports.shutil_get_terminal_size
Requirement already satisfied (use --upgrade to upgrade): backports.shutil_get_terminal_size in /.../anaconda/lib/python2.7/site-packages
๊ทธ๋ฌ๋ ์ผ๋ฐ python ์
ธ์์๋ import backports.shutil_get_terminal_size
๋ช
๋ น์ด ์คํจํฉ๋๋ค.
์ข์, ๋๋ ์กฐ์กํ์ง๋ง ๊ฐ๋จํ ํด๊ฒฐ์ฑ ์ ์ฐพ์์ต๋๋ค. ์ ๊ฑฐํ๊ณ ๋ค์ ์ค์นํ์ญ์์ค. ์ด์ ipython์ด ์๋ํฉ๋๋ค....
$ pip uninstall backports.shutil_get_terminal_size
Uninstalling backports.shutil-get-terminal-size-1.0.0:
/home/pierre/Programmes/anaconda/lib/python2.7/site-packages/backports
/home/pierre/Programmes/anaconda/lib/python2.7/site-packages/backports.shutil_get_terminal_size-1.0.0-py2.7.egg-info
Proceed (y/n)? y
Successfully uninstalled backports.shutil-get-terminal-size-1.0.0
$ pip install backports.shutil_get_terminal_size
Collecting backports.shutil_get_terminal_size
Downloading backports.shutil_get_terminal_size-1.0.0-py2.py3-none-any.whl
Installing collected packages: backports.shutil-get-terminal-size
Successfully installed backports.shutil-get-terminal-size-1.0.0
๋ํ์ด ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ต๋๋ค.
์ฌํ๊ฒ๋ ์์ ์ด๋ค ๊ฒ๋ ๋์์ด ๋์ง ์์์ง๋ง ๋ฌธ์ ๋ ์์ ๋ณด๊ณ ๋ ๊ฒ๊ณผ ๊ฐ์ต๋๋ค.
ImportError: shutil_get_terminal_size๋ผ๋ ๋ชจ๋์ด ์์ต๋๋ค.
IPython๊ณผ ๋ฐฑ ํฌํธ๋ฅผ ์ ๊ฑฐํ๊ณ ์ค์นํ๋ ๊ฒ์ ์ฆ๊ฒ์ง ์์์ต๋๋ค.
๋ฌธ์ ๋ Jupyter์ ์น๊ตฌ๋ค์ด ์ ์ธ๊ณ์ ์ผ๋ก ์ค์น๋์ด ์๊ณ shutil_get_terminal_size๊ฐ ์ ์ธ๊ณ์ ์ผ๋ก ์ค์น๋์ด ์๋ค๋ ๊ฒ์ ๋๋ค. ์ฆ /Library/Python/2.7/site-packages/shutil_backports/
๊ทธ๋ฌ๋ ๋๋ ๋ํ backports.functools_lru_cache๋ฅผ ๋ก์ปฌ์ ์ค์นํ๊ณ ์ด๊ฒ์ ์ค์ ๋ก shutil_backports์ ๊ฐ์ ธ์ค๊ธฐ๋ฅผ ์ฐจ๋จํ์ต๋๋ค.
์ด๊ฒ์ด ๋ฌธ์ ์ธ์ง ํ ์คํธํ๋ ค๋ฉด ๋ค์์ ์ํํ์ญ์์ค. ls ~/Library/Python/2.7/lib/python/site-packages (OSX์์ ํด๋ ๋ฐฑ ํฌํธ๊ฐ ๋ณด์ด๋ฉด ์๋ง๋ ์๋ชป์ผ ๊ฒ์ ๋๋ค. ์ฌ์ฉ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ ๊ฑฐํ๊ณ ์์คํ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ถ๊ฐํ์ต๋๋ค.์ด๋ ์ชฝ์ด๋ ๋ฐฑ ํฌํธ๋ฅผ ํผํฉ ๋ฐ ์ผ์น์ํฌ ์ ์์ต๋๋ค.์์ ํ ์๋ํ๋ ค๋ฉด ์ ์ญ ๋๋ ๋ก์ปฌ์ด์ด์ผ ํฉ๋๋ค.
Debian Sid(Unstable)์ ๋์ผํ ๋ฌธ์ ๊ฐ ์์ ํ ์ ๋ฐ์ดํธ๋์์ต๋๋ค. ๋๋ pip๋ฅผ ์ ๋ฐ์ดํธํ์ต๋๋ค. ์ ๊ฑฐํ๊ณ ์๋ก ์ค์นํ๋ ค๊ณ ์๋ํ์ต๋๋ค. ๋ฑ. ์๋ฌด ๊ฒ๋ ์๋ํ์ง ์์์ต๋๋ค.
# uname -a
Linux bunsen 4.7.0-1-amd64 #1 SMP Debian 4.7.2-1 (2016-08-28) x86_64 GNU/Linux
# pip2 --version
pip 8.1.2 from /usr/local/lib/python2.7/dist-packages (python 2.7)
# pip show ipython
---
Metadata-Version: 2.0
Name: ipython
Version: 5.1.0
Summary: IPython: Productive Interactive Computing
Home-page: http://ipython.org
Author: The IPython Development Team
Author-email: [email protected]
Installer: pip
License: BSD
Location: /usr/local/lib/python2.7/dist-packages
Requires: pickleshare, simplegeneric, traitlets, backports.shutil-get-terminal-size, decorator, pygments, prompt-toolkit, pexpect, pathlib2, setuptools
Classifiers:
Framework :: IPython
Intended Audience :: Developers
Intended Audience :: Science/Research
License :: OSI Approved :: BSD License
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Topic :: System :: Shells
Entry-points:
[console_scripts]
iptest = IPython.testing.iptestcontroller:main
iptest2 = IPython.testing.iptestcontroller:main
ipython = IPython:start_ipython
ipython2 = IPython:start_ipython
[pygments.lexers]
ipython = IPython.lib.lexers:IPythonLexer
ipython3 = IPython.lib.lexers:IPython3Lexer
ipythonconsole = IPython.lib.lexers:IPythonConsoleLexer
backports.shutil_get_terminal_size๋ฅผ ์ ๊ฑฐํ๊ณ ์ค์นํ๋ฉด ๋ค์ ์๋ํฉ๋๋ค.
OSX์์ +1. ๋์ผํ ๋ฌธ์ - ์ ์ญ ์ ๊ฑฐ ๋ฐ virtualenv์ ์ค์น๊ฐ ์๋ํ๊ณ ๋ก์ปฌ์ ๊ฐ๋ฆฌํต๋๋ค.
@Hiczeke ๋๋ ๊ทธ๊ฒ์ ์๋ํ์ง๋ง ์๋ํ์ง ์์๋ค
๋ง์ ์๋ ๋์ ํด๊ฒฐ๋ ์ต์ข
๋ช
๋ น์ setuptools
์
๋ฐ์ดํธํ๋ ๊ฒ์ด์์ต๋๋ค.
๋๋ ์ถ์ฒํ ๊ฒ์ด๋ค:
ipython
๋ฐ python-backports-shutil-get-terminal-size
์ ๊ฐ์ ์์คํ
ํจํค์ง๋ฅผ ์ ๊ฑฐํฉ๋๋ค.ipython
, jupyter
๋ฐ backports.shutil_get_terminal_size
pip
๋ฐ setuptools:
pip install --upgrade setuptools pip`pip install ipython jupyter
๋ค์์ ๋๋ฅผ ์ํด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ต๋๋ค.
pip ์ ๊ฑฐ backports.shutil_get_terminal_size
pip install backports.shutil_get_terminal_size
@Paul-Richter @Hiczeke
์ ๋ง ๊ฐ์ฌํฉ๋๋ค!
"backports.shutil_get_terminal_size"๋ฅผ ๋ค์ ์ค์นํ๋ฉด ์ ์๋ํ์ต๋๋ค.
pip install --upgrade --force-reinstall ipython
๋ด Mac์์ ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค.
๋๋ ๊ฝค ํผ๋ ์ค๋ฝ๋ค :
sudo pip uninstall backports.shutil_get_window_size
>>Cannot uninstall requirement backports.shutil-get-window-size, not installed
sudo pip install backports.shutil_get_window_size
>>Could not find a version that satisfies the requirement backports.shutil_get_window_size (from versions: )
>>No matching distribution found for backports.shutil_get_window_size
๋น์ ์ ์ํด ๊ณ ์ณค์ต๋๋ค, ์ด์.
sudo pip ์ ๊ฑฐ backports.shutil_get_ ํฐ๋ฏธ๋ _size
sudo pip install backports.shutil_get_ ํฐ๋ฏธ๋ _ํฌ๊ธฐ
2017๋
1์ 25์ผ ์์์ผ ์คํ 12:52 Ian Hincks [email protected]
์ผ๋ค:
๋๋ ๊ฝค ํผ๋ ์ค๋ฝ๋ค :
sudo pip ์ ๊ฑฐ backports.shutil_get_window_size
์๊ตฌ ์ฌํญ backports.shutil-get-window-size, ์ค์น๋์ง ์์์ ์ ๊ฑฐํ ์ ์์ต๋๋ค.
sudo pip install backports.shutil_get_window_size
backports.shutil_get_window_size ์๊ตฌ ์ฌํญ์ ์ถฉ์กฑํ๋ ๋ฒ์ ์ ์ฐพ์ ์ ์์ต๋๋ค(๋ฒ์ ์์: ).
backports.shutil_get_window_size์ ๋ํด ์ผ์นํ๋ ๋ฐฐํฌํ์ ์ฐพ์ ์ ์์ต๋๋ค.โ
๋น์ ์ด ์ธ๊ธ๋์๊ธฐ ๋๋ฌธ์ ์ด๊ฒ์ ๋ฐ๋ ๊ฒ์ ๋๋ค.
์ด ์ด๋ฉ์ผ์ ์ง์ ๋ต์ฅํ๊ณ GitHub์์ ํ์ธํ์ธ์.
https://github.com/ipython/ipython/issues/9656#issuecomment-275197674 ,
๋๋ ์ค๋ ๋ ์์๊ฑฐ
https://github.com/notifications/unsubscribe-auth/ATln0kDS_u6PaTk6Qunjc_oEtKCv_-cRks5rV5n7gaJpZM4I9MnS
.
@Paul-Richter ์, ๊ฐ์ฌํฉ๋๋ค :)
์ ๊ฑฐ/์ฌ์ค์น ์ค ์ด๋ ๊ฒ๋ ๋๋ฅผ ์ํด ์ผํ์ง ์์์ต๋๋ค. ๊ฒฐ๊ตญ ๋๋ฅผ ์ํด ์ผํ ๊ฒ์ ์์ ์ฃผ์์์ @ternus ๊ฐ ์ ์ํ ๊ฒ์
๋๋ค. (linux์์) /usr/local/lib/python2.7/dist-packages/IPython/utils/terminal.py
์ด๊ณ ํ์ ๋ณ๊ฒฝํ์ญ์์ค.
from backports.shutil_get_terminal_size import get_terminal_size as _get_terminal_size
์๊ฒ
from shutil_backports import get_terminal_size as _get_terminal_size
@ihincks : ๊ทํ์ ์๊ฒฌ์ด osx์์ ์ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ต๋๋ค ๐
์ค๋ OS X 10.12.3์์ ์ด ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค. ๋ค์์ด ํด๊ฒฐ๋์์ต๋๋ค.
pip install --upgrade pip setuptools
pip install --upgrade --force-reinstall ipython
๋๋ ์ด๊ฒ์ด ipython ์ค๋ฅ๋ผ๊ณ ๋ฏฟ์ง ์์ต๋๋ค. ํ์๋ฅผ ๊ถ์ฅํฉ๋๋ค.
๋๋ ๊ทธ๊ฒ์ด IPython ์ค๋ฅ๊ฐ ์๋๋ผ๊ณ ํ์ ํ์ง๋ง ์ค์ ๋ก ๋ฌด์์ด ์๋ชป๋์ด ์ฌ๋๋ค์๊ฒ ์ฌ์ค์น+ํฌ๋ง๋ณด๋ค ๋ ๋์ ์๋ฃจ์ ์ ์ ๊ณตํ ์ ์๊ธฐ๋ฅผ ๋ฐ๋๋๋ค...
@pierre-haesig ๋น์ ์ ๋์ ํ๋ฃจ๋ฅผ ์ ์ฅํฉ๋๋ค. ๋๋จํ ๊ฐ์ฌํฉ๋๋ค.
https://github.com/chrippa/backports.shutil_get_terminal_size/issues/9#issuecomment -279021331์ ํ์ธ
@ihincks ๋ชจ๋ ๊ฒ์๋ฌผ์ ์๋ํ์ง๋ง ์๋ฌด ๊ฒ๋ ์๋ํ์ง ์์์ต๋๋ค. ๋น์ ๋ง์ด ํจ๊ณผ๊ฐ ์์์ต๋๋ค. ๋น์ ์ ์๋ช ์ ์์ธ์ ๋๋ค :)
ihincks์ ์์ ์ Windows 10์์๋ ์๋ํฉ๋๋ค.
๋๋ ๊ทธ๊ฒ์ด ๋๊ตฐ๊ฐ๋ฅผ ๋์ธ ์ ์๊ธฐ๋ฅผ ๋ฐ๋๋๋ค.
์ ๊ฒฝ์ฐ์๋ ๋ฌธ์ ์ ์์ธ์ด ์๋ชป๋ ipython ๋ฒ์ ์ด๋ผ๋ ๊ฒ์ ์์์ต๋๋ค.
ls -lah /usr/local/bin/ipython*
-rwxr-xr-x 1 z staff 247B Mar 5 15:16 /usr/local/bin/ipython
-rwxr-xr-x 1 z staff 247B Mar 5 15:16 /usr/local/bin/ipython3
๋๋ python3 ๋ฒ์ ์ด ์ ํ ์๊ธฐ ๋๋ฌธ์ ์ด๋ป๊ฒ ์ผ์ด๋ ์ ์๋์ง ๋ชจ๋ฅด๊ฒ ์ต๋๋ค.
๋ด ๋ฌธ์ ๋ ํ์ด์ฌ์ ์ ๊ฑฐํ๊ณ ๊ด๋ จ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ ๊ฑฐํ์ ๋ ํด๊ฒฐ๋์์ต๋๋ค.
brew uninstall python
rm -rf /usr/local/lib/python2.7
python์ ๋ค์ ์ค์นํ๊ณ pip์ ๋ฒ์ ๊ณผ ์์น๊ฐ ์ฌ๋ฐ๋ฅธ์ง ํ์ธํฉ๋๋ค.
pip 9.0.1 from /usr/local/lib/python2.7/site-packages (python 2.7)
pip2 install ipython
@ihincks
์ด๊ฒ์ ๋์๊ฒ ์ ์ผํ ์ ๋ต์ ๋๋ค.
sudo pip ์ ๊ฑฐ backports.shutil_get_terminal_size
sudo pip install backports.shutil_get_terminal_size
Pip์ sudo์ ํจ๊ป ์ฌ์ฉ๋์ด์๋ ์ ๋ฉ๋๋ค.
pip์ ํจ๊ป sudo๋ฅผ ์ฌ์ฉํ๋ฉด ์์คํ
์ด ์ด๋ฌํ ๋ฐฉ์์ผ๋ก ์์๋ฉ๋๋ค.
๋ฌธ์ ๊ฐ ์ค๋ช
ํฉ๋๋ค.
๋ฏธ๋์
>
@ihincks FreeBSD์์๋ ๊ทํ์ ์๋ฃจ์ ๋ง ์๋ํ์ต๋๋ค! ์ ๋ง ๊ฐ์ฌํฉ๋๋ค!
์ฐธ๊ณ ๋ก, ๋์ผํ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ง๋ง pip์์ --ignore-installed
์ต์
์ ์ฌ์ฉํด์ผ๋ง shutil_get_terminal_size
๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์์์ต๋๋ค. ๊ทธ๋ ์ง ์์ผ๋ฉด ํจํค์ง๊ฐ ์ฌ๋ฐ๋ฅด๊ฒ ๋ค์ ์ค์น๋์ง ์์ต๋๋ค.
pip install --ignore-installed backports.shutil_get_terminal_size
@AllanDaemon ์ ์๋ต์ผ๋ก ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค!
๋น์ทํ ๋ฌธ์ ์ ์ง๋ฉดํ์ผ๋ฉฐ backports.shutil_get_terminal_size๋ฅผ ์ ๊ฑฐํ๊ณ ๋ค์ ์ค์นํ์ฌ ํด๊ฒฐ๋์์ต๋๋ค.
pip ์ ๊ฑฐ backports.shutil_get_terminal_size
pip install backports.shutil_get_terminal_size
๋๋ ๊ฐ์ ๋ฌธ์ ๊ฐ ์์๋ค.
์์ ๋ง์ ์๋ฃจ์
์ ์๋ํ ํ ๋ง์นจ๋ด ๋ฌธ์ ๊ฐ $PATH ์ค์ ์ผ๋ก ์ธํ ๊ฒ์์ ๋ฐ๊ฒฌํ์ต๋๋ค.
์ด์ ์ pip install --user
์ต์
์ ์ฌ์ฉํ๊ธฐ ๋๋ฌธ์ /home/jin/.local/lib/python2.7
๊ฐ backports
์ ๋ค๋ฅธ ๋ฒ์ ์ด ์๋ $PATH์ ์์์ต๋๋ค.
.local/lib/python2.7
ํด๋๋ฅผ ์ญ์ ํ์ฌ ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ต๋๋ค.
$PATH์ ๋ฌธ์ ๊ฐ ์๋์ง ํ ์คํธํ๋ ค๋ฉด ๊ฐ๋จํ ์๋ํ ์ ์์ต๋๋ค.
import sys
print sys.path
์ด ๋ฌธ์ ๋ "์์คํ
" ๋ฐ "์ฌ์ฉ์" ์์น ๋ชจ๋์ "๋ฐฑํฌํธ"๊ฐ ์๊ธฐ ๋๋ฌธ์ ๋ฐ์ํฉ๋๋ค.
๋ด macOS์์ ์์คํ
์ shutil_get_terminal_size๋ฅผ ์ค์นํ์ง๋ง ์ฌ์ฉ์ ํ์ ๋ค๋ฅธ ํจํค์ง๊ฐ ์ค์น๋์ด ์์ต๋๋ค. ์ด ์ฌ์ฉ์ ํด๋๊ฐ ์ฐ์ ํ๋ฉฐ ์์คํ
์์ ๊ฒ์ํ์ง ์์ต๋๋ค.
--user๋ฅผ ์ฌ์ฉํ์ฌ ๋ชจ๋ python ํจํค์ง๋ฅผ ์ค์นํ๋ ๊ฒ์ด ํ๋ช
ํฉ๋๋ค.
๋งํ ๊ฒฝ์ฐ --user๋ฅผ ์ฌ์ฉํ์ฌ ๊ฐ์ ๋ก ๋ค์ ์ค์นํ์ญ์์ค.
pip install --ignore-installed backports.shutil_get_terminal_size --user
๋งค๋ฒ ๋ฒ๊ทธ๊ฐ ๋ฐ์ํ๋ฏ๋ก ์ผ๋ถ ์ง๋จ์ ์ถ๊ฐํด์ผ ํ ๊ฒ์
๋๋ค.
backports
๋ '๋ค์์คํ์ด์ค ํจํค์ง'์ฌ์ผ ํ๋ฉฐ, ์ด๋ ๊ฒ ๋ค๋ฅธ ์์น์ ํ์ ํจํค์ง๋ฅผ ์ค์นํ ์ ์์ต๋๋ค. ๊ทธ๋ฌ๋ ์์ ์ ์ผ๋ก ์๋ํ์ง ์๋ ๊ฒ ๊ฐ๊ณ ์ด์ ๋ฅผ ์ ์ ์์ต๋๋ค. ๋๋ ๊ทธ๊ฒ์ ๋ก์ปฌ์์ ๋๋ฒ๊ทธํ๊ธฐ ์ํด ์ฌํํ ์ ์๊ณ , ๋ค๋ฅธ ์ฌ๋๋ค์ ํตํด ๋๋ฒ๊ทธํ๋ ค๋ ๋์ ์๋๋ ๋จ์ง ์ด๋ฆฌ๋ฅ์ ํ ๋ฟ์
๋๋ค.
@takluyver https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=843898 ๋ณด์ จ๋์? ์ต๊ทผ 2~3๊ฐ์ ๊ฒ์๋ฌผ์ด ํฅ๋ฏธ๋กญ์ต๋๋ค.
๋ถํํ๋ ๋ด๊ฐ ์ฐพ์ ๊ฒ๊ณผ ๋ค์ ๋น์ทํฉ๋๋ค. backports
๋ค์์คํ์ด์ค ํจํค์ง๋ฅผ ์๋ง์ผ๋ก ๋ง๋ค๊ณ ์์ง๋ง ๋ฌด์์ ๋๋ โโ์ด๋ป๊ฒ ํด๊ฒฐํ ์ ์์ต๋๋ค. ๋ฐ๋น์์ pip ์ค์น ํจํค์ง๊ฐ ๋ฌธ์ ๋ฅผ ์ผ์ผํค๋๋ผ๋ ๋ฌธ์ ๊ฐ ๋์ง ์๋๋ค๊ณ ์ ๋นํ๊ฒ ๋งํ์ต๋๋ค.
๋๋ https://github.com/chrippa/backports.shutil_get_terminal_size/issues/9#issuecomment -279021331์ ๋๊ธ์ ๋ฌ์๊ณ pip๋ฅผ ํตํด ํ ๋ ๋น ํ (๋น ๋ฐ์ด๋๋ฆฌ) ์ค์น ๊ฐ์ ์ฐจ์ด์ ์ ์ฐพ๋ ๋ฐ ์์์ ์ธ๊ธํ์ต๋๋ค. ๊ด๋ จ์ด ์์ต๋๊น?
๋ค์ ๋ฒ์ ์ IPython์ ๋ํ ๋์ฒด๋ก ๋ฒค๋๋ง์ ์ด๋ป์ต๋๊น?
์ด๊ฒ์ด CPython์ Shutil๋ก ๋ฐฑํฌํธ๋ ์ ์๋ ๊ฒ์ ๋๊น?
์ด๊ฒ์ด CPython์ Shutil๋ก ๋ฐฑํฌํธ๋ ์ ์๋ ๊ฒ์ ๋๊น?
์๋ง๋ ์๋์ค, ์ฐ๋ฆฌ๋ ์ด๋ฏธ IPython 6.0/master์์ backport
ํจํค์ง๋ฅผ ์ฌ์ฉํ๊ณ ์์ง ์์ต๋๋ค. ์ด๊ฒ์ ์ด๋ฏธ ์ฐ๋ฆฌ๊ฐ ์ง์ํ๋ ๋ชจ๋ CPython ๋ง๊ตฌ๊ฐ์ ์์ผ๋ฉฐ, ๋ฌธ์ ๋ 2.7์์ backport
ํจํค์ง๋ฅผ ์ฌ์ฉํ๊ธฐ ๋๋ฌธ์ ๋ฐ์ํฉ๋๋ค. ์ด๊ฒ์ ํ์ค CPython 2.7์ ์๊ธฐ ๋๋ฌธ์
๋๋ค.
์์์ด์. @Carreau๋ ๊ฐ์ฌํฉ๋๋ค. ์ผ์์ ์ธ ๋ฌธ์ ์ผ ๋ฟ์ด๋ผ ๋คํ์ ๋๋ค.
์ ์ญ ์ค์น๋ฅผ ์ญ์ ํ๊ณ virtualenv์์ ์ ๊ฑฐํ๊ณ virtualenv์์ ๋ค์ ์ค์นํ๋ฉด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค.
์๋ ๋ช ๋ น์ ์ ๋ ฅํ๊ธฐ๋ง ํ๋ฉด ๋ฉ๋๋ค.
conda config --add channels conda-forge
conda install backports.shutil_get_terminal_size
๋๋ ๊ฐ์ ๋ฌธ์ ๊ฐ ์์๊ณ ์ด๊ฒ์ด ํด๊ฒฐ๋์์ต๋๋ค.
์๋
ํ์ธ์
ipython2๋ฅผ ์ฌ์ฉํ๋ Ubuntu 17.10์์๋ ๋์ผํ ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค.
python3์ ๋ฌธ์ ์์
FIX: sudo -H pip install --ignore-installed backports.shutil_get_terminal_size ์ค์น
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 17.10
Release: 17.10
Codename: artful
$ python --version
Python 2.7.14
$ python3 --version
Python 3.6.3
$ pip show ipython
Name: ipython
Version: 5.1.0
Summary: IPython: Productive Interactive Computing
Home-page: http://ipython.org
Author: The IPython Development Team
Author-email: [email protected]
License: BSD
Location: /usr/lib/python2.7/dist-packages
Requires: backports.shutil-get-terminal-size, pathlib2, pexpect
$ pip3 show ipython
Name: ipython
Version: 5.1.0
Summary: IPython: Productive Interactive Computing
Home-page: http://ipython.org
Author: The IPython Development Team
Author-email: [email protected]
License: BSD
Location: /usr/lib/python3/dist-packages
Requires: pexpect
$ ipython
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/IPython/__init__.py", line 48, in <module>
from .core.application import Application
File "/usr/lib/python2.7/dist-packages/IPython/core/application.py", line 25, in <module>
from IPython.core import release, crashhandler
File "/usr/lib/python2.7/dist-packages/IPython/core/crashhandler.py", line 28, in <module>
from IPython.core import ultratb
File "/usr/lib/python2.7/dist-packages/IPython/core/ultratb.py", line 128, in <module>
from IPython.utils.terminal import get_terminal_size
File "/usr/lib/python2.7/dist-packages/IPython/utils/terminal.py", line 22, in <module>
from backports.shutil_get_terminal_size import get_terminal_size as _get_terminal_size
ImportError: No module named shutil_get_terminal_size
$ apt-cache show python-ipython
Package: python-ipython
Architecture: all
Version: 5.1.0-3
Priority: optional
Section: universe/python
Source: ipython
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Debian Python Modules Team <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 1864
Depends: python-decorator, python-pexpect, python-pickleshare, python-pkg-resources, python-prompt-toolkit, python-pygments, python-simplegeneric, python-traitlets, python:any (<< 2.8), python:any (>= 2.7.5-5~), python-backports-shutil-get-terminal-size, python-pathlib2
Breaks: ipython (<< 4)
Replaces: ipython (<< 4)
Filename: pool/universe/i/ipython/python-ipython_5.1.0-3_all.deb
Size: 375048
MD5sum: 7ae68256eb7c6183634ea3680ad4449d
SHA1: 7e2916b5e661793dcb55e86404de5cd1f0d19d8b
SHA256: 0664f1d3c5543cc3ba4db4fcd8bf4526de714e3f35687b49052fad7831cbdee3
Homepage: https://github.com/ipython/ipython
Description-en: Enhanced interactive Python shell (Python 2 version)
IPython can be used as a replacement for the standard Python shell,
or it can be used as a complete working environment for scientific
computing (like Matlab or Mathematica) when paired with the standard
Python scientific and numerical tools. It supports dynamic object
introspections, numbered input/output prompts, a macro system,
session logging, session restoring, complete system shell access,
verbose and colored traceback reports, auto-parentheses, auto-quoting,
and is embeddable in other Python programs.
.
This package contains the backend terminal shell for Python 2: for
the actual frontend install ipython.
Description-md5: 713480d81c0c64f1b3a9c4c9350ef96c
$ apt-cache show python3-ipython
Package: python3-ipython
Architecture: all
Version: 5.1.0-3
Priority: optional
Section: universe/python
Source: ipython
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Debian Python Modules Team <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 1864
Depends: python3-decorator, python3-pexpect, python3-pickleshare, python3-pkg-resources, python3-prompt-toolkit, python3-pygments, python3-simplegeneric, python3-traitlets, python3:any (>= 3.3.2-2~), python-pexpect
Breaks: ipython3 (<< 4)
Replaces: ipython3 (<< 4)
Filename: pool/universe/i/ipython/python3-ipython_5.1.0-3_all.deb
Size: 375114
MD5sum: c0585bf56c9fbcbb73aa45d25b8fbe14
SHA1: c7118d1050f50723d614a3060ad6d8d31a96e73c
SHA256: 293217ee356c2c2623efce3fc391b1876a38585b0ae7462b2a8a0d3f3424ec86
Homepage: https://github.com/ipython/ipython
Description-en: Enhanced interactive Python shell (Python 3 version)
IPython can be used as a replacement for the standard Python shell,
or it can be used as a complete working environment for scientific
computing (like Matlab or Mathematica) when paired with the standard
Python scientific and numerical tools. It supports dynamic object
introspections, numbered input/output prompts, a macro system,
session logging, session restoring, complete system shell access,
verbose and colored traceback reports, auto-parentheses, auto-quoting,
and is embeddable in other Python programs.
.
This package contains the backend terminal shell for Python 3: for
the actual frontend install ipython.
Description-md5: 8182f91eff6e0e148e574a20d31e0f51
@nicola-lunghi ์ ๋ฐ sudo pip
์ ์ฌ์ฉํ๋ผ๊ณ ์กฐ์ธํ์ง ๋ง์ธ์. ๊ทธ๋ฌ๋ฉด ์ฅ๊ธฐ์ ์ผ๋ก ์์คํ
์ด ์ด์ํ๊ฒ ๋ง๊ฐ์ง ๋ฟ์
๋๋ค. Pip๋ ์ผ๋ถ ํ์ผ์ ๋ํด ์์คํ
ํจํค์ง ๊ด๋ฆฌ์์ ์ธ์ธ ๊ฒ์
๋๋ค.
์ด๋ ์ ๊ธฐ์ ์ผ๋ก ๋ฐค์ ๊นจ์ฐ๊ธฐ ๋๋ฌธ์ ์ผ์ฐํํ์ ์๋์์ ๋ฐฐํฐ๋ฆฌ๋ฅผ ์ ๊ฑฐํ๋ ๊ฒ๊ณผ ๊ฐ์ต๋๋ค. ํํฐ์ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. ์ ์ ํ ์์ ์ด ํ์ํฉ๋๋ค.
@Carreau ๊ฐ์ฌํฉ๋๋ค
์ง์ ๋ถ์ ๋๊ณ ๋ต๋ณ์ ์์ ํ๊ฒ ์ต๋๋ค.
์ถ์ : "heather" -> deb ์ข ์์ฑ์ ์์ ํ์ญ์์ค.
๊ฐ์ฅ ์ฌ์ด ์์ ์ ์๋ง๋ pip install --user ipython
๋ก ์ต์ ๋ฒ์ ์ IPython์ ์ค์นํ๋ ๊ฒ์
๋๋ค( --user
ํ๋๊ทธ๋ sudo๊ฐ ํ์ํ์ง ์์์ ์๋ฏธํฉ๋๋ค). ์ฐ๋ฆฌ๋ ์ด๋ฏธ IPython์์ ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ง๋ง ๋ฐ๋น์ ํจํค์ง๋ฅผ ์ ์ดํ ์ ์์ผ๋ฉฐ apt๋ฅผ ํตํด ์ค์นํ๋ ์ฌ์ฉ์๋ ์ค๋๋ ๋ฒ์ ์ IPython์ ์ป์ต๋๋ค.
๋๊ตฐ๊ฐ Cygwin ๋ฐ python2์์ ๋์ผํ ๋ฌธ์ ๊ฐ ๋ฐ์ํ๋ ๊ฒฝ์ฐ ์๋ฃจ์
์ Cygwin setup.exe(๋๋ apt-cyg utls ์ค ํ๋)๋ฅผ ์คํํ๊ณ python2-backports.shutil_get_terminal_size
์
๋๋ค. ์ด๊ฒ์ ๊ธฐ๋ณธ์ ์ผ๋ก ์ข
์์ฑ์ผ๋ก ํธ๋ฆฌ๊ฑฐ๋์ง ์์ผ๋ฏ๋ก ์๋์ผ๋ก ์ค์นํด์ผ ํฉ๋๋ค.
ipython3์ ๊ธฐ๋ณธ์ ์ผ๋ก ๊ด์ฐฎ์ต๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
์ด๋ป๊ฒ ๋ ์ข ์์ฑ์ ์ป์ง ์๊ณ IPython์ ์ค์น ํ ๊ฒ ๊ฐ์ต๋๋ค. ๋ด๊ฐ ์์ ๋ณธ ๊ฒ์ ๊ฐ์ํ ๋ ์ด๊ฒ์ ์๋ง๋ ๋๋ฌด ์ค๋๋ ๋ฒ์ ์ setuptools๋ฅผ ๊ฐ์ง๊ณ ์๊ณ
easy_install
ํฉ๋๋ค. ๋จผ์ ๋น๊ต์ ์ต๊ทผ์ pip/setuptools๊ฐ ์๋์ง ํ์ธํ์ญ์์ค.๊ทธ๋ฐ ๋ค์, pip๋ฅผ ์ฌ์ฉํ์ฌ IPython์ ๋ค์ ์ค์นํด ๋ณด์ญ์์ค(pip๊ฐ ์๋ํ์ง ์๊ฑฐ๋ ์๋ํ์ง ์๋ ํฉ๋นํ ์ด์ ๊ฐ ์๋ค๋ ๊ฒ์ ์์ง ๋ชปํ๋ ํ easy_install์ ์ฌ์ฉํ์ง ๋ง์ญ์์ค. ์ด๋ฌํ ๊ฒฝ์ฐ๋ ๋๋ญ ๋๋ค):