【问题标题】:pip install package from url来自 url 的 pip 安装包
【发布时间】:2011-10-14 13:50:43
【问题描述】:
pip install http://www.crummy.com/software/BeautifulSoup/unreleased/4.x/BeautifulSoup-4.0b.tar.gz

这会安装 bs4 包,一切正常。但是如果我将此行添加到 requirements.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

【问题讨论】:

  • 抱歉,我无法重现此内容。为我工作。
  • a) 您是否尝试过“import BeautifulSoup”,b) 您是否检查了 python 路径以查看是否实际安装了 BS,以及 c) 您是否使用 virtualenv 或类似的东西?
  • 它作为 bs4 包安装,因为它是 4.0 版本。它在 3.2 版中作为 BeautifulSoup 导入
  • 您说pip install http://.... 有效,您确定吗?你试过import bs4吗?
  • 是的,它与 url 参数一起使用。现在我尝试再次执行此操作,并且使用 requirements.txt 安装也可以!貌似新版pip支持了。

标签: python beautifulsoup pip


【解决方案1】:

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

【讨论】:

    【解决方案2】:

    当您使用 便携式软件 或使用 多个 版本的 Python / IDLE

    时会发生这种情况

    出现的情况是只能安装在默认路径,否则需要想办法专门安装在需要的路径

    (对我来说,当我在 windows 中使用 pip 时 cmd 在 pycharm 中不起作用,但在使用 pycharm 中的 pip 时起作用)

    【讨论】:

      猜你喜欢
      • 2010-11-05
      • 2017-05-20
      • 2015-10-12
      • 2019-06-01
      • 2019-02-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-27
      相关资源
      最近更新 更多