python-module - ImportError:在 MacOS 上没有名为“pystan”的模块
问题描述
我pystan
使用pip install pystan
. 我检查了模块是否与 pip freeze 一起列出。但是当我使用import pystan
. 它给出了找不到模块的错误。
下面是 pip freeze 命令的输出。它显示 pystan 版本 3.3.0
aiohttp==3.7.4.post0
appdirs==1.4.4
async-timeout==3.0.1
attrs==21.2.0
chardet==4.0.0
clikit==0.6.2
crashtest==0.3.1
httpstan==4.6.0
idna==3.2
lz4==3.1.3
marshmallow==3.13.0
multidict==5.2.0
numpy==1.21.2
pandas==1.3.3
pastel==0.2.1
pylev==1.4.0
pysimdjson==3.2.0
pystan==3.3.0
python-dateutil==2.8.2
pytz==2021.3
six==1.16.0
typing-extensions==3.10.0.2
webargs==8.0.1
yarl==1.7.0
但是,当我尝试从控制台导入模块时,它会引发以下错误。
import pystan
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'pystan'
导入列出的任何其他模块不会引发错误。
解决方案
我在这个链接上找到了解决方案
显然,最新版本的 pystan (>= 3) 在 import 语句中使用 stan 而不是 pystan,而在早期版本中它只是 pystan。
如果你安装 pystan (>=3) 使用import stan
而不是import pystan
推荐阅读
- c# - 如何使用对象列表而不是循环填充 SQL Server 数据库
- regex - Perl替换匹配模式上方一行中的字符串
- c# - 在 C# 中通过串行端口进行高速串行通信
- mysql - 运行查询时是否可以在导出 .csv 文件中硬编码下拉菜单?
- node.js - 角度形式组 patchValue 围绕值包装大括号
- node.js - 上传图片时出现错误 500(内部服务器错误)
- qr-code - 如何在二维码中编码 Ctrl 函数?
- python - 服务于 TensorFlow 预建的线性分类器估计器模型
- c# - 在哪里添加代码以根据来自另一个模型字段值的值填充数据库中模型字段的值
- jvm - 确定 String 是否为编译时常量