1

我正在尝试在 Google Colaboratory 上安装和导入MDAnalysis和 MDAnalysisTests 库,我尝试了三种方法,但没有任何效果:

  1. 使用默认值:!pip install library
!pip install MDAnalysis

但我得到:

Collecting MDAnalysis
  Using cached https://files.pythonhosted.org/packages/9e/19/1d32ded1891605facf6faf6e0de4ff6bd33db3f7983d84cfc10074363990/MDAnalysis-1.0.1.tar.gz
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我读到这种错误与缺少补充库或其他东西有关,但我不知道在哪里可以找到更多信息,所以我希望,也许这个论坛中的某个人知道 MDAnalysis 是否需要特定的东西。我不知道egg_info是什么,搜索我在这里找到了一个带有代码中文本#egg=的示例,但我在最后一次尝试中更多地讨论了这个选项。

  1. 使用默认值:!apt-get -qq install -y library
!apt-get -qq install -y MDAnalysis

输出:

E: Unable to locate package MDAnalysis

两者都不起作用。

  1. 来自 GitHub

在一个预览问题中,我发现我可以从 GitHub 导入库!惊人的!(老实说,我根本不懂语法),所以我查找了MDAnalysis GitHub 存储库并编写了以下代码:

!pip install git+https://github.com/MDAnalysis/mdanalysis.git

输出:

Collecting git+https://github.com/MDAnalysis/mdanalysis.git
  Cloning https://github.com/MDAnalysis/mdanalysis.git to /tmp/pip-req-build-4e7svv83
  Running command git clone -q https://github.com/MDAnalysis/mdanalysis.git /tmp/pip-req-build-4e7svv83
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我发现了 git+git:, git+ssh: 的变体,但没有用。

这是 MDAnalysis 在 Colab 上工作的特定问题吗?还是代码有问题?我什至尝试通过“mdanalysis”更改“MDAnalysis”。我在这个论坛上按照Colab 的指南安装和预览问题,但我没有结果。感谢阅读。

4

1 回答 1

1

您可以使用 conda 在 Colab 中安装 MDA(需要一些时间)。

!wget -O mini.sh https://repo.anaconda.com/miniconda/Miniconda3-4.6.14-Linux-x86_64.sh 
!bash ./mini.sh -b -f -p /usr/local
!conda install -q -y --prefix /usr/local -c conda-forge mdanalysis
import sys
sys.path.append('/usr/local/lib/python3.7/site-packages/')

然后就可以导入了

import MDAnalysis as mda
于 2021-03-13T13:06:41.003 回答