我使用pystan在python虚拟环境中安装了pip install pystan。我检查了模块是用pip冻结列出的。但是当我用import pystan运行代码时。给出了模块找不到的错误。
下面是pip冻结命令的输出。它展示了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'导入列出的任何其他模块都不会引发错误。
发布于 2021-10-07 12:43:34
我在这个链接上找到了解决方案
显然,pystan的最新版本(>= 3)在import语句中使用stan而不是pystan,而在早期版本中只是pystan。
如果安装pystan (>=3),请使用import stan而不是import pystan
https://stackoverflow.com/questions/69481156
复制相似问题