Pycharm无法导入数学模块 [英] Pycharm cannot import math module

查看:570
本文介绍了Pycharm无法导入数学模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在pycharm中导入标准数学模块,但出现错误:没有名为math的模块",我可以从python shell导入它,这是什么原因引起的?

I can't import standard math module in pycharm, I'm getting an error: "No module named math", from python shell I can import it, what can cause that?

推荐答案

在设置">项目">项目解释器"中检查您是否指向正确的python文件.

Check that you are pointing to the correct python file within Settings > Project > Project Interpreter.

过去我遇到这个问题时,我的解释器指向的是venv的bin文件夹中的 python3.6 而不是 python .我只是放下了解释器,然后再次添加它,指向venv-name/bin/python

When I've had this problem in the past my interpreter was pointing at python3.6 and not python within the bin folder of my venv. I simply dropped the interpreter and added it again pointing to the venv-name/bin/python

这篇关于Pycharm无法导入数学模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆