attributeError:模块' tensorly'没有属性分解'
我在Python上使用了一个软件包(Tensorly),在那里我无法访问所有模块。
例如,如果我尝试使用“分解”模块:
- python版本:3.9.12
- 张力版本:0.7
i运行:
pip3 install tensorly
python3 main.py
main.py:
### imports ###
import tensorly
### tensor decomposition ###
cp = tensorly.decomposition.CP(n)
tougpy: outpty:
AttributeError: module 'tensorly' has no attribute 'decomposition'
ps:ps:当我转到/.local/lib/python3.9/site-site--软件包/张力是有模块分解,当我打印SYS.PATH时,有相同站点包装的路径。
我有另一个软件包的问题(Cobrapy)以及其他不同版本的Python(3.6)
更新:
现在我有Scikit-Learn:输出完全相同的问题
from sklearn.preprocessingcessing import StandardScaler
:
No module named 'sklearn.preprocessingcessing'
即使此软件包在.prepropocessingcessing之前确实运行良好),该错误今天也随机弹出...
I’m using a package (tensorly) on python where I don't have access to all the modules.
For example if I try to use the 'decomposition' module :
- python version: 3.9.12
- tensorly version : 0.7
I run :
pip3 install tensorly
python3 main.py
main.py :
### imports ###
import tensorly
### tensor decomposition ###
cp = tensorly.decomposition.CP(n)
output :
AttributeError: module 'tensorly' has no attribute 'decomposition'
PS: When I go to /.local/lib/python3.9/site-packages/tensorly there is the module decomposition and when I print my sys.path there is the path for this same site-packages.
I have the same problem with another package (cobrapy) and on other different machines with other versions of python (3.6)
Update :
Now I have the exact same problem with scikit-learn:
from sklearn.preprocessingcessing import StandardScaler
Output :
No module named 'sklearn.preprocessingcessing'
Even if this package worked really well before (no error with .preprocessingcessing), this error popped out randomly today...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须首先导入要使用的子模块,如果默认情况下未加载它(您可以检查
__ INIT __。py
文件以查看默认情况下导入哪些模块)。换句话说,仅首先导入
分解
:或直接导入要使用的分解方法:
您的Scikit-Learn示例中也有错字。
You have to first import the submodule you want to use if it isn't loaded by default (you can check the
__init__.py
file to see what modules are imported by default).In other words, just first import
decomposition
:Or directly import the decomposition methods you want to use:
You also have a typo in your Scikit-Learn example.