Home>

I'm new to programming.
There may be deficiencies or deficiencies in the question. In that case, please forgive me as it will be added as appropriate.
I installed the library in the anaconda environment, but I can't import it.
The device used is MacBookPro 13inch, Mid 2012, and the version is catalina 10.15.1.
The installed library is "beautifulsoup4". The version is 4.8.1.
The terminal login shell is zsh.

Error message

The following is an error message that occurred when executed with python in an anaconda environment.

Traceback (most recent call last):
  File "/Users/******/Desktop/******/******/******.py", line 10, in<module>
    import beautifulsoup4
ModuleNotFoundError: No module named 'beautifulsoup4'


Under the terminal, the installation is completed as follows,
It seemed that it was installed properly in the "conda list" (the installation was confirmed in the environment of anaconda as well).

% conda list
beautifulsoup4 4.8.1 py37_0
% conda install beautifulsoup4
Collecting package metadata (current_repodata.json): done
Solving environment: done
# All requested packages already installed.

There is no confusion between pip and conda, so although it is an amateur's judgment, it seems that the installation destination is not different.
Those who have been installed with pip "from bs4 import Beautifulsoup",
Or though it was imported as "from beautifulsoup4 import Beautifulsoup",
As far as I tried

ImportError: cannot import name 'Beautifulsoup' from 'bs4' (/Users/******/anaconda3/lib/python3.7/site-packages/bs4/__init__.py)


After all, import was not possible.

Also, I've looked at some similar questions like "Can't import library",
As far as I'm concerned, most of the cases are due to confusion of installation locations. In my case it was not helpful.
Sorry for your inconvenience, but please answer.
Please point out if there are any deficiencies.

  • Answer # 1

    Incorrectfrom bs4 import Beautifulsoup
    Positivefrom bs4 import BeautifulSoup