python - Python 模块 ortools 显然安装不完整
问题描述
我正在尝试ortools
在我的 Mac 上进行设置。
我通过pip install ortools
. 我可以验证包安装成功。
conda list | grep ortools
WARNING: The conda.compat module is deprecated and will be removed in a future release.
ortools 7.1.6720 pypi_0 pypi
当我尝试使用该库时,似乎缺少功能。我跟着这里的例子:
https://developers.google.com/optimization/introduction/python
这将返回一个错误:
from __future__ import print_function
from ortools.linear_solver import pywraplp
Traceback (most recent call last):
File "simple_ortools_example.py", line 2, in <module>
from ortools.linear_solver import pywraplp
ImportError: No module named ortools.linear_solver
否则我可以导入模块并以交互方式查看函数:
>>> ortools.__
ortools.__cached__ ortools.__gt__( ortools.__path__
ortools.__class__( ortools.__hash__( ortools.__reduce__(
ortools.__delattr__( ortools.__init__( ortools.__reduce_ex__(
ortools.__dict__ ortools.__init_subclass__( ortools.__repr__(
ortools.__dir__( ortools.__le__( ortools.__setattr__(
ortools.__doc__ ortools.__loader__ ortools.__sizeof__(
ortools.__eq__( ortools.__lt__( ortools.__spec__
ortools.__file__ ortools.__name__ ortools.__str__(
ortools.__format__( ortools.__ne__( ortools.__subclasshook__(
ortools.__ge__( ortools.__new__( ortools.__version__
ortools.__getattribute__( ortools.__package__
我只是在这里使用了 tab complete 来查看可用的内容。果然,ortools 模块没有附加 linear_solver。
我有点不知所措,不知道下一步该尝试什么。任何建议都将不胜感激。
解决方案
我降级到解决问题的早期版本。
pip install ortools==6.7.4973
推荐阅读
- node.js - 如何在把手中嵌套的每个中获取孩子的价值?
- pandas - Dask - 连接两个相同列的数据帧不起作用
- asp.net-core - 我可以从 .net 核心应用程序调用 Web 表单服务吗?
- roblox - 返回被忽略
- python-3.x - 创建 TXT 文件并在 Python 中寻找职位
- mongodb - 从 mongo 集合中的数组中删除一个条目
- node.js - Telegraf.js:使用按钮离开 WizardScene
- react-router - 如何在 React Router v5 中更新 URL 并替换历史状态而不重新渲染整个应用程序?
- android - 更新材料库后如何修复“包裹:解组时找不到类:androidx.fragment.app.FragmentManagerState”?
- python - 使用列表在 Python 中进行猴子修补