0

enter image description here

  1. First attempt was to add BeautifulSoup to the python interpreter in pycharm. Then import in the IDE. I received the following error. I then tried closing and reopneing PyCharm, then restarting the machine. While I am not posting my entire project here I am preforming some web scraping using Beautiful Soup.... My code on another machine in Jupyter works just fine, but I have a requirement on this machine to use PyCharm. Can anyone help?

my code was simply

from bs4 import BeautifulSoup
print('hello')

ERROR RECIEVED: C:\Users\sherian\PycharmProjects\pythonProject\venv\Scripts\python.exe C:/Users/sherian/PycharmProjects/pythonProject/main.py hello Traceback (most recent call last): File "C:/Users/sherian/PycharmProjects/pythonProject/main.py", line 2, in from bs4 import beautifulsoup ImportError: cannot import name 'beautifulsoup' from 'bs4' (C:\Users\sherian\PycharmProjects\pythonProject\venv\lib\site-packages\bs4_init_.py)

Process finished with exit code 1

showing library imports in Pycharm

jshers
  • 9
  • 2
  • @bad_coder I am not sure this answers the question. So is this file path for bueatifulsoup4 inapporpiate... see screenshot below I highlighted the package in pycharm interpreter..., ive added the screenshot to main post – jshers May 17 '21 at 14:19

1 Answers1

0

Whenever you start a new project ,try to create a virtual environment in python first and then install all the required packages in it. Then run your project your problem will get automatically solved.

  • do you have any links to how to start a virtual environment? – jshers May 17 '21 at 14:20
  • https://docs.python.org/3/library/venv.html#:~:text=A%20virtual%20environment%20is%20a,part%20of%20your%20operating%20system. –  May 17 '21 at 14:27
  • follow this link : create virtual env, activate it , install beautifulsoup in it and then run it. –  May 17 '21 at 14:27