我在 Python 中导入一个名为“scanpy”的包时遇到了很多麻烦 - 我一直在尝试在此处遵循本教程(https://scanpy-tutorials.readthedocs.io/en/latest/pbmc3k.html)但 Python 似乎将“scanpy”视为包的模块而不是包本身:
import numpy as np
import pandas as pd
import scanpy as sc
sc.settings.verbosity = 3
sc.logging.print_header()
sc.settings.set_figure_params(dpi=80, facecolor='white')
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-2-129af3139565> in <module>
----> 1 sc.settings.verbosity = 3
2 sc.logging.print_header()
3 sc.settings.set_figure_params(dpi=80, facecolor='white')
AttributeError: module 'scanpy' has no attribute 'settings'
其他人似乎也无法安装“scanpy”,所以我在这个 GitHub 线程 ( https://github.com/theislab/scanpy/issues/990 ) 上按照 kleurless 的安装说明进行操作。这是那些安装说明的结果。(另外,我还遵循了“scanpy”网站上的安装说明,但这些说明似乎不起作用。)如果这很重要,我还在 Jupyter Notebook 中运行上述代码行。我在加载 Jupyter Notebook 之前忘记加载虚拟环境,所以我在第一行之前添加了“!source activate scanpy_environment”,但这没有帮助。如果有人可以帮助我,我将非常感激。