问题
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