Httpie: ImportError: 'pkg_resources'๋ผ๋Š” ๋ชจ๋“ˆ์ด ์—†์Šต๋‹ˆ๋‹ค.

์— ๋งŒ๋“  2016๋…„ 08์›” 19์ผ  ยท  7์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: httpie/httpie

โžœ ~ http --help
์—ญ์ถ”์ (๊ฐ€์žฅ ์ตœ๊ทผ ํ˜ธ์ถœ ๋งˆ์ง€๋ง‰):
ํŒŒ์ผ "/usr/local/Cellar/httpie/0.9.4/libexec/bin/http", 5ํ–‰,
pkg_resources์—์„œ load_entry_point ๊ฐ€์ ธ์˜ค๊ธฐ
ImportError: 'pkg_resources'๋ผ๋Š” ๋ชจ๋“ˆ์ด ์—†์Šต๋‹ˆ๋‹ค.

๊ฐ€์žฅ ์œ ์šฉํ•œ ๋Œ“๊ธ€

๋‚˜๋„ ๋ฐฉ๊ธˆ ์ด๊ฒƒ์— ๋ถ€๋”ช์ณค๋‹ค. ์„ค์น˜ ์˜ค๋ฅ˜๋ฅผ ๋ณด๋‹ˆ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

==> Installing dependencies for httpie: python3
==> Installing httpie dependency: python3
==> Downloading https://homebrew.bintray.com/bottles/python3-3.5.2_1.el_capitan.bottle.2.tar.gz
######################################################################## 100.0%
==> Pouring python3-3.5.2_1.el_capitan.bottle.2.tar.gz
==> Using the sandbox
==> /usr/local/Cellar/python3/3.5.2_1/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python3/3.5.2_1/bin --install-lib=/usr/local/lib/python3.5/site-pa
Last 15 lines from /Users/jsheeley/Library/Logs/Homebrew/python3/post_install.01.python3:
-s
setup.py
--no-user-cfg
install
--force
--verbose
--install-scripts=/usr/local/Cellar/python3/3.5.2_1/bin
--install-lib=/usr/local/lib/python3.5/site-packages
--single-version-externally-managed
--record=installed.txt

Failed to import the site module
Your PYTHONPATH points to a site-packages dir for Python 2.x but you are running Python 3.x!
     PYTHONPATH is currently: "/Library/Python/2.7/site-packages:/usr/local/lib/python2.7/site-packages:/Users/jsheeley/.venvburrito/lib/python2.7/site-packages"
     You should `unset PYTHONPATH` to fix this.
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall python3`
==> Caveats
Pip, setuptools, and wheel have been installed. To update them
  pip3 install --upgrade pip setuptools wheel
... (etc)

์ˆ˜์ •ํ•˜๊ธฐ ์œ„ํ•ด ๋‹ค์Œ์„ ์‹คํ–‰ํ–ˆ์Šต๋‹ˆ๋‹ค.

โœ— unset PYTHONPATH
โœ— brew postinstall python3

๊ทธ๋Ÿฐ ๋‹ค์Œ httpie๋ฅผ ์‹œ๋„ํ•˜์‹ญ์‹œ์˜ค.

โœ— http google.com
HTTP/1.1 301 Moved Permanently
Cache-Control: public, max-age=2592000
Content-Length: 219
Content-Type: text/html; charset=UTF-8
Date: Fri, 23 Sep 2016 04:34:37 GMT
Expires: Sun, 23 Oct 2016 04:34:37 GMT
Location: http://www.google.com/
Server: gws
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>

python3์„ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์„ค์น˜ํ•˜๋ฉด ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค(PYTHONPATH๋ฅผ ์ด์ „ ๊ฐ’์œผ๋กœ ์„ค์ •ํ•œ ๊ฒฝ์šฐ์—๋„).

brew์˜ ์ตœ๊ทผ 1.0.0 ๋ฆด๋ฆฌ์Šค์—์„œ๋„ ์ด๊ฒƒ์ด ๋ณตํ•ฉ์ ์ด๋ผ๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค. ์ด๊ฒƒ์€ ์ €๋ฅผ ์œ„ํ•ด ๋งŽ์€ ํŒŒ์ด์ฌ ์‚ฌํ•ญ์„ ๋ณ€๊ฒฝํ•œ ๊ฒƒ์œผ๋กœ ๋ณด์ด๋ฉฐ ์—ฌ๋Ÿฌ ํŒจํ‚ค์ง€๋ฅผ ๋‹ค์‹œ ์„ค์น˜ํ•ด์•ผ ํ–ˆ์Šต๋‹ˆ๋‹ค.

๋ชจ๋“  7 ๋Œ“๊ธ€

์ถฉ๋Œ

@badjano ์ด์ „ ๋ฒ„์ „์ž…๋‹ˆ๋‹ค. ๋…ธ๋ ฅํ•˜๋‹ค:

$ brew update && brew upgrade httpie

์—ญ์ถ”์ (๊ฐ€์žฅ ์ตœ๊ทผ ํ˜ธ์ถœ ๋งˆ์ง€๋ง‰):
ํŒŒ์ผ "/usr/local/Cellar/httpie/0.9.6/libexec/bin/http", 5ํ–‰,
pkg_resources์—์„œ load_entry_point ๊ฐ€์ ธ์˜ค๊ธฐ
ImportError: 'pkg_resources'๋ผ๋Š” ๋ชจ๋“ˆ์ด ์—†์Šต๋‹ˆ๋‹ค.

๋‚˜๋Š” ๊ฐ™์€ Mac์„ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ๋™๋ฃŒ๊ฐ€ ์žˆ์ง€๋งŒ ๊ทธ์˜ ์ž‘์—…์„ ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ €๋Š” python, pip, setuptools, brew upgrade, ๋ชจ๋“  ๊ฒƒ์„ ๋‹ค์‹œ ์„ค์น˜ํ–ˆ์ง€๋งŒ ์—ฌ์ „ํžˆ ๋ฌด์Šจ ์ผ์ด ์ผ์–ด๋‚˜๊ณ  ์žˆ๋Š”์ง€ ์•Œ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค

๋‚˜๋„ ๋ฐฉ๊ธˆ ์ด๊ฒƒ์— ๋ถ€๋”ช์ณค๋‹ค. ์„ค์น˜ ์˜ค๋ฅ˜๋ฅผ ๋ณด๋‹ˆ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

==> Installing dependencies for httpie: python3
==> Installing httpie dependency: python3
==> Downloading https://homebrew.bintray.com/bottles/python3-3.5.2_1.el_capitan.bottle.2.tar.gz
######################################################################## 100.0%
==> Pouring python3-3.5.2_1.el_capitan.bottle.2.tar.gz
==> Using the sandbox
==> /usr/local/Cellar/python3/3.5.2_1/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python3/3.5.2_1/bin --install-lib=/usr/local/lib/python3.5/site-pa
Last 15 lines from /Users/jsheeley/Library/Logs/Homebrew/python3/post_install.01.python3:
-s
setup.py
--no-user-cfg
install
--force
--verbose
--install-scripts=/usr/local/Cellar/python3/3.5.2_1/bin
--install-lib=/usr/local/lib/python3.5/site-packages
--single-version-externally-managed
--record=installed.txt

Failed to import the site module
Your PYTHONPATH points to a site-packages dir for Python 2.x but you are running Python 3.x!
     PYTHONPATH is currently: "/Library/Python/2.7/site-packages:/usr/local/lib/python2.7/site-packages:/Users/jsheeley/.venvburrito/lib/python2.7/site-packages"
     You should `unset PYTHONPATH` to fix this.
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall python3`
==> Caveats
Pip, setuptools, and wheel have been installed. To update them
  pip3 install --upgrade pip setuptools wheel
... (etc)

์ˆ˜์ •ํ•˜๊ธฐ ์œ„ํ•ด ๋‹ค์Œ์„ ์‹คํ–‰ํ–ˆ์Šต๋‹ˆ๋‹ค.

โœ— unset PYTHONPATH
โœ— brew postinstall python3

๊ทธ๋Ÿฐ ๋‹ค์Œ httpie๋ฅผ ์‹œ๋„ํ•˜์‹ญ์‹œ์˜ค.

โœ— http google.com
HTTP/1.1 301 Moved Permanently
Cache-Control: public, max-age=2592000
Content-Length: 219
Content-Type: text/html; charset=UTF-8
Date: Fri, 23 Sep 2016 04:34:37 GMT
Expires: Sun, 23 Oct 2016 04:34:37 GMT
Location: http://www.google.com/
Server: gws
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>

python3์„ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์„ค์น˜ํ•˜๋ฉด ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค(PYTHONPATH๋ฅผ ์ด์ „ ๊ฐ’์œผ๋กœ ์„ค์ •ํ•œ ๊ฒฝ์šฐ์—๋„).

brew์˜ ์ตœ๊ทผ 1.0.0 ๋ฆด๋ฆฌ์Šค์—์„œ๋„ ์ด๊ฒƒ์ด ๋ณตํ•ฉ์ ์ด๋ผ๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค. ์ด๊ฒƒ์€ ์ €๋ฅผ ์œ„ํ•ด ๋งŽ์€ ํŒŒ์ด์ฌ ์‚ฌํ•ญ์„ ๋ณ€๊ฒฝํ•œ ๊ฒƒ์œผ๋กœ ๋ณด์ด๋ฉฐ ์—ฌ๋Ÿฌ ํŒจํ‚ค์ง€๋ฅผ ๋‹ค์‹œ ์„ค์น˜ํ•ด์•ผ ํ–ˆ์Šต๋‹ˆ๋‹ค.

@sheeley ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ๋น„๋ก ๋‚ด python3์ด ์—ฐ๊ฒฐ๋˜์ง€ ์•Š์•˜๊ณ  ๊ฐ•์ œ๋กœ ์ œ๊ฑฐํ•˜๊ณ  ๋‹ค์‹œ ์„ค์น˜ํ•˜๊ธฐ๋กœ ๊ฒฐ์ •ํ–ˆ์ง€๋งŒ ์ด์ œ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค!

์ด๊ฒƒ์€ npm์„ 3.10.10์—์„œ 4.0.5๋กœ ์—…๊ทธ๋ ˆ์ด๋“œํ•œ ํ›„์— ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. @sheeley ์†”๋ฃจ์…˜์„ ์‹œ๋„ํ–ˆ์ง€๋งŒ ์ž‘๋™ํ•˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. ๋‚ด ์ˆ˜์ •์€ brew uninstall httpie ๋‹ค์Œ brew install httpie ์ด์—ˆ์Šต๋‹ˆ๋‹ค. ์ด์ œ ์ •์ƒ์œผ๋กœ ๋Œ์•„์™”์Šต๋‹ˆ๋‹ค. ์ฐธ๊ณ ๋กœ ์ด๊ฒƒ์€ macOS 10.9.5๋ฅผ ์‹คํ–‰ํ•˜๋Š” ๋‚ด MacBook Pro(2011๋…„ ์ดˆ)์— ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰