PyCharm 无法识别已安装的模块 [英] PyCharm doesn't recognise installed module

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

问题描述

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

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 无法识别已安装的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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