I'm working in Python and using Flask. When I run my main Python file on my computer, it works perfectly, but when I activate venv and run the Flask Python file in the terminal, it says that my main Python file has "No Module Named bs4." Any comments or advice is greatly appreciated.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
I will advise you to uninstall the bs4 library by using this command:
and then install it using this command:
I was facing the same problem in my Linux Ubuntu when I used the following command for installing bs4 library:
The easiest is using easy_install.
It will work if pip fails.
Try this. It works for me.
Activate the virtualenv, and then install BeautifulSoup4:
When you installed
bs4
witheasy_install
, you installed it system-wide. So your system python can import it, but not your virtualenv python. If you do not needbs4
to be installed in your system python path, uninstall it and keep it in your virtualenv.For more information about virtualenvs, read this
A lot of tutorials/references were written for Python 2 and tell you to use pip install somename. If you're using Python 3 you want to change that to pip3 install somename.
If you use Pycharm, go to preferences - project interpreter - install bs4. If you try to install BeautifulSoup, it will still show that no module named bs4.