1
我想从我的django项目中使用Java调用一些类。 这里是我的代码:从java导入django模块
PythonInterpreter interpreter = new PythonInterpreter();
PySystemState sys = Py.getSystemState();
sys.path.append(new PyString("/Library/Python/2.7/site-packages/"));
sys.path.append(new PyString("/myApps/categoryApp/review/"));
interpreter.exec("from products.models import Category");
但我得到这个错误:
Exception in thread "main" Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/myApps/categoryApp/review/products/models.py", line 4, in <module>
from django.core.exceptions import ValidationError
File "/Library/Python/2.7/site-packages/django/core/exceptions.py", line 4, in <module>
from functools import reduce
ImportError: cannot import name reduce
任何想法解决它? 我相信进口有问题
谢谢,我会尽快尝试 – Walucas