Pycharm not recognizing installed BeautifulSoup4 module

依然范特西╮ 提交于 2019-12-24 21:28:50

问题


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:

Grayed out code

Interpreter settings

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?


回答1:


See if this helps:

Go to the following path:

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

Also, below should be changed

from bs4 import BeautifulSoup


来源:https://stackoverflow.com/questions/52485162/pycharm-not-recognizing-installed-beautifulsoup4-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!