【问题标题】:Use package from Github in Conda Virtual Environment在 Conda 虚拟环境中使用来自 Github 的包
【发布时间】:2017-09-06 13:37:26
【问题描述】:

设置

  • Conda 虚拟环境
  • 在 Jupyter 笔记本中编码
  • Python 3.6 版

我在 Google 上搜索过,通过 Conda 帮助搜索,本网站上的 github 帮助以及发现密切相关的问题,只是不回答我的问题:

第一个很接近。

基本上我的问题归结为:

为了让我的代码正常工作,我需要导入这个 repo:https://github.com/nicocanali/airtable-python

我怎样才能让它在我的 Jupyter Notebook 中使用?

我需要将它添加到我的虚拟环境中。但是怎么做?

【问题讨论】:

  • 您只需激活您的环境(以便调用正确的 pip)并以某种兼容的形式使用 pip install 直接从 github 安装(请参阅所有其他问题)。

标签: python git jupyter conda


【解决方案1】:

我最终做了以下事情:

  1. 虚拟环境安装git:(conda install git)
  2. 克隆项目。 (git 克隆 [URL])
  3. 安装包(cd到包含setup.py的包目录。
  4. 然后运行“python setup.py install”)。

在视频的第一部分找到了答案:How to Install Python Package from GitHub

【讨论】:

    【解决方案2】:

    https://github.com/nicocanali/airtable-python 安装到您的jupyter。

    从 github 网站下载 repo 的 .zip。

    要在 jupyter 中安装它,请从 anaconda 控制台输入以下命令。

    pip install [path_to_.zip_file_on_pc]
    

    适用于任何 github 文件

    【讨论】:

      【解决方案3】:

      在这里找到了一个简单的解决方案:

      https://medium.com/i-want-to-be-the-very-best/installing-packages-from-github-with-conda-commands-ebf10de396f4

      例如,要安装位于 https://github.com/Netflix/metaflow,在 Anaconda 提示符下导航到你想要的环境,激活环境,然后执行以下命令:

      conda install git
      conda install pip
      pip install git+git://github.com/Netflix/metaflow.git
      

      (请注意,git 包在 Anaconda Navigator 中可用,因此可以从那里安装,而不是从 Anaconda 提示符安装。)

      【讨论】:

        猜你喜欢
        • 2021-05-16
        • 2018-04-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-06-18
        • 2021-02-27
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多