我在Windows 10计算机上的Spyder上使用Python 3.7版本。我正在尝试在Spyder中导入blend模块。我已经在终端上使用pip命令成功安装了模块blend,但是当我尝试运行此命令时,它显示模块Resource的导入错误。然后,我尝试在终端中安装资源模块,并且安装成功。 Blend和资源模块都已安装,并且在Spyder上运行此命令时仍然看到此导入错误。
(base) C:\WINDOWS\system32>pip install blend
Requirement already satisfied: blend in c:\programdata\anaconda3\lib\site-packages (0.1.5)
(base) C:\WINDOWS\system32>blend
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\Scripts\blend", line 3, in <module>
import blend
File "C:\ProgramData\Anaconda3\lib\site-packages\blend\__init__.py", line 25, in <module>
from Resource import Resource
ImportError: No module named 'Resource'
(base) C:\WINDOWS\system32>pip install Resource
Requirement already satisfied: Resource in c:\programdata\anaconda3\lib\site-packages (0.2.1)
Requirement already satisfied: python-easyconfig>=0.1.0 in c:\programdata\anaconda3\lib\site-packages (from Resource) (0.1.7)
Requirement already satisfied: JsonForm>=0.0.2 in c:\programdata\anaconda3\lib\site-packages (from Resource) (0.0.2)
Requirement already satisfied: JsonSir>=0.0.2 in c:\programdata\anaconda3\lib\site-packages (from Resource) (0.0.2)
Requirement already satisfied: six in c:\programdata\anaconda3\lib\site-packages (from python-easyconfig>=0.1.0->Resource) (1.11.0)
Requirement already satisfied: PyYAML in c:\programdata\anaconda3\lib\site-packages (from python-easyconfig>=0.1.0->Resource) (3.13)
Requirement already satisfied: jsonschema in c:\programdata\anaconda3\lib\site-packages (from JsonForm>=0.0.2->Resource) (2.6.0)
(base) C:\WINDOWS\system32>blend
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\Scripts\blend", line 3, in <module>
import blend
File "C:\ProgramData\Anaconda3\lib\site-packages\blend\__init__.py", line 25, in <module>
from Resource import Resource
ImportError: No module named 'Resource'
答案 0 :(得分:0)
混合似乎很旧(last commit 6 year ago,last release,2013年2月16日)。它doesn't list any dependency,所以我确定它不需要package Resource,它正在尝试导入its own module Resource,但是它使用绝对导入(Python2导入方式)来导入模块。
因此,我确定代码仅适用于Python2。