简体   繁体   English

无法导入似乎已安装的 package

[英]Unable to import a package that seems to have been installed

I am trying to work with the TimeSynth Python package in my Conda environment.我正在尝试在我的 Conda 环境中使用 TimeSynth Python package。 It is not available on the pkgs list or conda-forge list of Conda-supported packages, so I found this post that seems to get around the issue by installing the package in the Conda environment using pip .它在 Conda 支持的软件包的 pkgs 列表或 conda-forge 列表中不可用,因此我发现这篇文章似乎可以通过使用pip在 Conda 环境中安装 package 来解决此问题。

I followed the instructions in the accepted answer, however when I do the last step:我按照接受的答案中的说明进行操作,但是当我执行最后一步时:

.conda/envs/tcl/bin/pip install timesynth

( tcl is the name of my environment) tcl是我的环境的名称)

It says the requirement is already satisfied:它说要求已经满足:

Requirement already satisfied: timesynth in./.conda/envs/tcl/lib/python3.6/site-packages (0.2.4)已满足要求:timesynth in./.conda/envs/tcl/lib/python3.6/site-packages (0.2.4)

Requirement already satisfied: scipy in./.conda/envs/tcl/lib/python3.6/site-packages (from timesynth) (1.4.1)要求已经满足:scipy in./.conda/envs/tcl/lib/python3.6/site-packages(来自timesynth)(1.4.1)

Requirement already satisfied: jitcxde-common==1.4.1 in./.conda/envs/tcl/lib/python3.6/site-packages (from timesynth) (1.4.1)要求已经满足:jitcxde-common==1.4.1 in./.conda/envs/tcl/lib/python3.6/site-packages(来自timesynth)(1.4.1)

Requirement already satisfied: numpy in./.conda/envs/tcl/lib/python3.6/site-packages (from timesynth) (1.18.1)要求已经满足:numpy in./.conda/envs/tcl/lib/python3.6/site-packages(来自timesynth)(1.18.1)

Requirement already satisfied: sympy in./.conda/envs/tcl/lib/python3.6/site-packages (from timesynth) (1.8)要求已经满足:sympy in./.conda/envs/tcl/lib/python3.6/site-packages(来自timesynth)(1.8)

Requirement already satisfied: symengine==0.4 in./.conda/envs/tcl/lib/python3.6/site-packages (from timesynth) (0.4.0)要求已经满足:symengine==0.4 in./.conda/envs/tcl/lib/python3.6/site-packages(来自timesynth)(0.4.0)

Requirement already satisfied: jitcdde==1.4 in./.conda/envs/tcl/lib/python3.6/site-packages (from timesynth) (1.4.0)要求已经满足:jitcdde==1.4 in./.conda/envs/tcl/lib/python3.6/site-packages(来自timesynth)(1.4.0)

Requirement already satisfied: jinja2 in./.conda/envs/tcl/lib/python3.6/site-packages (from jitcxde-common==1.4.1->timesynth) (3.0.0a1)已满足要求:jinja2 in./.conda/envs/tcl/lib/python3.6/site-packages(来自 jitcxde-common==1.4.1->timesynth)(3.0.0a1)

Requirement already satisfied: setuptools in./.local/lib/python3.6/site-packages (from jitcxde-common==1.4.1->timesynth) (56.2.0)已满足要求:./.local/lib/python3.6/site-packages 中的 setuptools(来自 jitcxde-common==1.4.1->timesynth)(56.2.0)

Requirement already satisfied: MarkupSafe>=1.1 in./.conda/envs/tcl/lib/python3.6/site-packages (from jinja2->jitcxde-common==1.4.1->timesynth) (2.0.0)已满足要求:MarkupSafe>=1.1 in./.conda/envs/tcl/lib/python3.6/site-packages(来自 jinja2->jitcxde-common==1.4.1->timesynth)(2.0.0)

Requirement already satisfied: mpmath>=0.19 in./.conda/envs/tcl/lib/python3.6/site-packages (from sympy->timesynth) (1.2.1)已满足要求:mpmath>=0.19 in./.conda/envs/tcl/lib/python3.6/site-packages(来自 sympy->timesynth)(1.2.1)

However when I run a Python script that imports timesynth, it doesn't recognize the module.但是,当我运行导入时间合成器的 Python 脚本时,它无法识别该模块。 Any advice?有什么建议吗?

EDIT: Per request, here is the start of the file I'm trying to use timesynth in:编辑:根据请求,这是我尝试在其中使用 timesynth 的文件的开头:

import numpy as np
import TimeSynth.timesynth as ts
import matplotlib.pyplot as plt
import seaborn as sns; sns.set()

And the error cites line 2 and states:错误引用了第 2 行并指出:

ModuleNotFoundError: No module named 'TimeSynth' ModuleNotFoundError:没有名为“TimeSynth”的模块

Following the TimeSynth library's example , the import statement of OP按照TimeSynth库的例子,OP的import语句

import TimeSynth.timesynth as ts

should instead be应该改为

import timesynth as ts

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM