I'm using Python 3.6 and BeautifulSoup is installed in my computer with:
pip install beautifulsoup
How can I treat this:
Traceback (most recent call last): File "I:\application
python\rechere1.py", line 5, in from bs4 import
BeautifulSoup File "I:\application python\bs4.py", line 3, in
from bs4 import BeautifulSoup ImportError: cannot import
name 'BeautifulSoup' >>>
Related
Traceback (most recent call last):
File "d:/project.py", line 2, in <module>
from bs4 import BeautifulSoup
ModuleNotFoundError: No module named 'bs4'
Guys any idea why i get this error.
Ive installed bs4 with cmd and pip
Where do i have to install the module i am really confused
Some of them work and some of them dont
For example, bs4 doesnt but tkinter does
I have Python 3.0.1 and beautifulsoup 4.1.0 but when I try and run from bs4 import BeautifulSoup, I receive this error message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named bs4
I have read that some of the versions of beautiful soup don't work with certain versions of Python but because I am unfamiliar and haven't used either before I am unsure of which versions I should download.
I have next python 2.7 (debian) code
import sys
import random
from bs4 import BeautifulSoup
from YandexDiskException import YandexDiskException
from YandexDiskRestClient import YandexDiskRestClient
I try run, but get this message
root#vps-1074211:/tmp/beautifulsoup4-4.4.0# python /var/vah13/untitled/grep.py
Traceback (most recent call last):
File "/var/vah13/untitled/grep.py", line 5, in <module>
from bs4 import BeautifulSoup
ImportError: No module named bs4
how fix it?
I installed
pip install beautifulsoup4
apt-get install python-bs4
I've used these modules before, even in a Python script inside a folder where I have other working scripts. Here's my imports:
import os
import sys
import urllib.request as urllib, simplejson as json, requests
import subprocess
import Popen, PIPE
import time
I get this in my console:
Traceback (most recent call last):
File "party.py", line 4, in <module>
import urllib.request as urllib, simplejson as json, requests
ImportError: No module named request
How come? I've tried
sudo pip install request
..but with no luck. What is causing this?
what python version are you using? urllib.request seems to be python3
v2.7
>>> import urllib.request
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named request
>>>
v3.3
>>> import urllib.request
>>> urllib.request
<module 'urllib.request' from '/usr/lib/python3.3/urllib/request.py'>
>>>
I am trying to use beautifulsoup compatible lxml and it is giving me an error:
from lxml.html.soupparser import fromstring
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/lxml/html/soupparser.py", line 7, in <module>
from BeautifulSoup import \
ImportError: No module named BeautifulSoup
I have bs4 installed. How do I fix this issue?
The error is caused by soupparser.py trying to import BeautifulSoup version 3 while you have version 4 installed. The module name was changed from BeautifulSoup to bs4 in version 4.
You can trick soupparser.py into importing version 4 by mapping the bs4 module to BeautifulSoup in sys.modules before importing soupparser:
import sys, bs4
sys.modules['BeautifulSoup'] = bs4
from lxml.html.soupparser import fromstring
There is now a version of soupparser that works with bs4. It's available here: https://github.com/lxml/lxml/blob/master/src/lxml/html/soupparser.py
Try adding :
from bs4 import BeautifulSoup
and make sure you have the correct version of BeautifulSoup for your system installed.