Pycharm cannot import math module

2019-07-12 01:53发布

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?

3条回答
霸刀☆藐视天下
2楼-- · 2019-07-12 02:35

File >> Settings >> Project interpreter. You should see a list of currently installed packages/libraries. If the module is not specified in there click the plus sign and look for your module in there. Also make sure you specify it correctly when you import it.

查看更多
Luminary・发光体
3楼-- · 2019-07-12 02:36

I had a similar issue and was able to fix it by creating a new Python system interpreter. Project Interpreter -> Add Local -> System Interpreter -> /usr/local/bin/python3

查看更多
虎瘦雄心在
4楼-- · 2019-07-12 02:39

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

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

查看更多
登录 后发表回答