Pycharm无法识别已安装的BeautifulSoup4模块 [英] Pycharm not recognizing installed BeautifulSoup4 module

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

问题描述

我在Pycharm识别已安装模块方面遇到麻烦.我在Windows 10上将Pycharm 2018.2.4 CE与Python 3.7 x64结合使用,未安装Python 2.x.我使用'pip'和'pip3'命令从命令行安装了请求和BeautifulSoup4. Pip列表和Pycharm在解释器列表中看到已安装的模块,但是当我输入我的代码时,它像所有未安装的一样显示为灰色:

I have trouble with Pycharm recognizing installed modules. I'm using Pycharm 2018.2.4 CE with Python 3.7 x64, on Windows 10. I don't have Python 2.x installed. I installed requests and BeautifulSoup4 from command line using 'pip' and 'pip3' commands. Pip list and Pycharm is seeing installed module in interpreters list but when I enter my code is grayed out like none of those were installed:

显示为灰色的代码

解释器设置

我尝试了一切-重新安装Python(x64和x86)和Pycharm,安装/升级/卸载BeautifulSoup4和bs4,我还尝试了可以​​在堆栈或google上找到的所有解决方案,似乎很少有人遇到类似的问题,但是没人给了他们任何最终答案.有谁知道如何在Windows 10下解决此问题?

I tried everything - reinstalling both Python (x64 and x86) and Pycharm, installing/upgrading/uninstalling BeautifulSoup4 and bs4, I also tried every solution I could find on stack or google, seems like few people had similar issue but no one gave them any final answer. Does anyone know how to fix this under Windows 10?

推荐答案

看看是否有帮助:

转到以下路径:

File/ Settings/ Project: Project_Name/ Project Interpreter

单击右侧的加号,在此处找到模块并安装.

Click on the plus sign on the right, find the module there and install it.

另外,如果它们是灰色的,那是因为您已导入它们但尚未使用它们.唯一可能有问题的是最后一个可能带有红线的地方.

Also, if they are gray, it's because you have imported them but haven't used them yet. The only one which might have a problem is the last one with the red lines maybe.

此处进行了讨论

This was discussed here

此外,以下内容应更改

from bs4 import BeautifulSoup

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

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