从 url pip 安装包

发布于 2024-12-09 17:59:17 字数 920 浏览 1 评论 0原文

pip install http://www.crummy.com/software/BeautifulSoup/unreleased/4.x/BeautifulSoup-4.0b.tar.gz

这将安装 bs4 软件包,一切正常。但是,如果我将此行添加到 requests.txt

http://www.crummy.com/software/BeautifulSoup/unreleased/4.x/BeautifulSoup-4.0b.tar.gz

并运行

pip install -r requirements.txt

输出,

  Downloading/unpacking http://www.crummy.com/software/BeautifulSoup/unreleased/4.x/BeautifulSoup-4.0b.tar.gz (from -r requirements.txt (line 40))
  Downloading BeautifulSoup-4.0b.tar.gz (42Kb): 42Kb downloaded
  Running setup.py egg_info for package from http://www.crummy.com/software/BeautifulSoup/unreleased/4.x/BeautifulSoup-4.0b.tar.gz

但该包未安装。

>>> import bs4
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named bs4
pip install http://www.crummy.com/software/BeautifulSoup/unreleased/4.x/BeautifulSoup-4.0b.tar.gz

this installs package bs4, and everything is ok. But if I add this line to requirements.txt

http://www.crummy.com/software/BeautifulSoup/unreleased/4.x/BeautifulSoup-4.0b.tar.gz

and run

pip install -r requirements.txt

the output is

  Downloading/unpacking http://www.crummy.com/software/BeautifulSoup/unreleased/4.x/BeautifulSoup-4.0b.tar.gz (from -r requirements.txt (line 40))
  Downloading BeautifulSoup-4.0b.tar.gz (42Kb): 42Kb downloaded
  Running setup.py egg_info for package from http://www.crummy.com/software/BeautifulSoup/unreleased/4.x/BeautifulSoup-4.0b.tar.gz

but the package doesn't get installed.

>>> import bs4
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named bs4

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

苍暮颜 2024-12-16 17:59:17

请注意,如果您安装了多个解释器并且 pip 使用一个解释器(例如,2.6)而您的 python shell 使用另一个解释器(例如,2.7),则可能会发生这种情况

Note that this can happen if you have more than one interpreter installed and pip is using one (e.g., 2.6) and your python shell another (e.g., 2.7)

白馒头 2024-12-16 17:59:17

当您使用便携式软件多个版本的Python / IDLE时会发生这种

情况,您只能安装在默认路径中b>,否则你需要找到一种方法来专门安装在所需路径

(对我来说,当我在Windows中使用pip时cmd在pycharm中不起作用但是当使用 pycharm 中的 pip 时可以工作)

this happens when you are working with portable software or with more than one versions of Python / IDLE

what happens is that you can only install in the default path, otherwise you need to find a way to specifically install in the required path

(for me when I used pip from the windows cmd did not work in pycharm but when used pip from pycharm worked)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文