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 版本也加剧了这种情况——它似乎为我改变了一些 python 的东西,我不得不重新安装一些包。

所有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升级,一切,仍然无法弄清楚发生了什么

我也遇到了这个。 查看安装错误,我看到了这个:

==> 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 版本也加剧了这种情况——它似乎为我改变了一些 python 的东西,我不得不重新安装一些包。

谢谢@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 等级

相关问题

whodidthis picture whodidthis  ·  24评论

mahmoudhossam picture mahmoudhossam  ·  17评论

altfatterz picture altfatterz  ·  27评论

ryanmcdermott picture ryanmcdermott  ·  24评论

aventurella picture aventurella  ·  13评论