PyCharm无法识别已安装的模块

PyCharm无法识别已安装的模块

本文介绍了PyCharm无法识别已安装的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在Mac上使用请求"模块.我使用python34并通过pip安装了"requests"模块.我可以通过再次运行安装来验证这一点,它会告诉我该模块已经安装.

I'm having trouble with using 'requests' module on my Mac. I use python34 and I installed 'requests' module via pip. I can verify this via running installation again and it'll show me that module is already installed.

15:49:29|mymac [~]:pip install requests
Requirement already satisfied (use --upgrade to upgrade): requests in /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages

尽管我可以通过交互式Python解释器导入请求"模块,但是尝试在PyCharm中执行导入请求"会产生错误没有名为请求的模块".我检查了我的PyCharm Python解释器设置,并且(我相信)将其设置为与我的环境中使用的python34相同.但是,我也看不到PyCharm中列出的请求"模块.

Although I can import 'requests' module via interactive Python interpreter, trying to execute 'import requests' in PyCharm yields error 'No module named requests'. I checked my PyCharm Python interpreter settings and (I believe) it's set to same python34 as used in my environment. However, I can't see 'requests' module listed in PyCharm either.

很明显,我在这里错过了一些东西.你们能建议我应该在哪里寻找或应该修理什么才能使该模块正常工作?我的印象是,当我在自己的环境中通过pip安装模块时,PyCharm将检测到这些更改.但是,看来我这边坏了...

It's obvious that I'm missing something here. Can you guys advise where should I look or what should I fix in order to get this module working? I was living under impression that when I install module via pip in my environment, PyCharm will detect these changes. However, it seems something is broken on my side ...

推荐答案

如果您使用的是PyCharms CE(社区版),请单击:

If you are using PyCharms CE (Community Edition), then click on:

File->Default Settings->Project Interpretor

查看底部的+号,然后单击它.它将打开另一个对话框,其中包含大量可用模块.选择您的包裹(例如请求),剩下的事情将由PyCharm完成.

See the + sign at the bottom, click on it. It will open another dialog with a host of modules available. Select your package (e.g. requests) and PyCharm will do the rest.

MD

这篇关于PyCharm无法识别已安装的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 13:42