在 Conda 虚拟环境中使用来自 Github 的包

Use package from Github in Conda Virtual Environment

设置

我用 Google 搜索过,通过 Conda 帮助进行了搜索,github 在此站点上找到了帮助,并找到了密切相关的问题,只是没有回答我的问题:

虽然第一个很接近。

基本上我的问题归结为:

为了使我的代码正常工作,我需要导入此存储库:https://github.com/nicocanali/airtable-python

如何才能在我的 Jupyter Notebook 中使用它?

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

我最后做了以下事情:

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

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

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

从 github 网站下载 repo 的 .zip。

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

pip install [path_to_.zip_file_on_pc]

适用于任何 github 文件

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

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 提示符安装。)