当我在 Python 上提供路径时出现 ModuleNotFound 错误

问题描述 投票:0回答:1

下面是我的文件设置:

|-桌面

|--Python项目

|---高级项目

|----pyspectra-master

|-----pyspectra-master

|-----pyspectra

我的目标是将库从 pyspectra 导入 Jupyter Notebook。键入此代码时出现 ModuleNotFoundError:

from pyspectra.readers.read_spc import read_spc

我不确定为什么会这样。我也收到此代码的错误:

from pyspectra_master import pyspectra

我应该如何用破折号调用 pyspectra-master?这似乎不可能。

有没有更简单的方法将模块导入 python?我看到可以直接从 Github 导入模块。


Macgyver 手动创建虚拟环境的笔记:

python3 -m venv --system-site-packages /opt/venv01
cd /opt/venv01
source /opt/venv01/bin/activate
pip install openpyxl==3.0.7
pip install pyspectra
python github import module python-module
1个回答
0
投票

在 Anaconda 中打开 IPython 并输入:

conda install git pip

转到 Jupyter Notebook 并输入:

!pip install git+https://github.com/fujiisoup/pyspectra.git

Pyspectra 可以在此之后导入。

© www.soinside.com 2019 - 2024. All rights reserved.