BeautifulSoup installation error - python

I installed Beautiful Soup using pip and after that when I ran it in cmd I am getting the following error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python34\bs4\__init__.py", line 175
except Exception, e:
SyntaxError: invalid syntax
I used pip install beautifulSoup4 to install beautifulSoup Then i ran the python interpreter from cmd and wrote from bs4 import BeautifulSoup and I got the above error

Related

how to solve "ModuleNotFoundError: No module named 'beautifulsoup4'"?

I'm work in Python Idle.
I installed BeautifulSoup4 with "pip install beautifulsoup4" in Powershell, and it works in Powershell's python.
But when I run in Python Idle
# Read Library
from bs4 import BeautifulSoup
error message said
Traceback (most recent call last):
File "C:/Users/umts1202/Desktop/ML/bs-test1.py", line 2, in <module>
from bs4 import BeautifulSoup
ModuleNotFoundError: No module named 'bs4'
I have no idea what to do. Please help me :(

How to Install Excel Module on Python 3.6(64 bit)?

Tried to import the excel module but this is the result,
>>> pip install openpyxl==2.1.4
File "<stdin>", line 1
pip install openpyxl==2.1.4
^
SyntaxError: invalid syntax
As seen, I also don't have the excel module,
>>>import openpyxl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'openpyxl'
pip is used on the command line. To use it in the shell:
>>> import pip
>>> pip.main(['install', 'openpyxl==2.1.4'])
Or just type it into your Terminal or Command Prompt application to run the command.

Python/BeautifulSoup Download

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.

pip unable to install any package and terminal broken

I tried to install a python package "BeautifulSoup" and it gave a error message: "pkg_resources.DistributionNotFound". After going through stackoverflow website I download a python script and ran it:
https://svn.apache.org/repos/asf/oodt/tools/oodtsite.publisher/trunk/distribute_setup.py
Now it is throwing a new error message when I try to install sudo pip install beautifulsoup4:
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python3.4/dist-packages/pkg_resources.py", line 45
def _bypass_ensure_directory(name, mode=0777):
SyntaxError: invalid token
Another interesting thing is when a type a wrong command in terminal like "lss" or anything error message is like this appear:
Traceback (most recent call last):
File "/usr/lib/command-not-found", line 8, in <module>
import CommandNotFound
File "/usr/share/command-not-found/CommandNotFound/__init__.py", line 1, in <module>
from CommandNotFound import CommandNotFound
File "/usr/share/command-not-found/CommandNotFound/CommandNotFound.py", line 13
except gdbm.error, err:
SyntaxError: invalid syntax
Could someone guide me in how to resolve this? My system:
kernel: 3.16.0-4-amd64 x86_64 (64 bit)
desktop: MATE 1.10.0
distro: LinuxMint 2 betsy
Solution
Changed the symblic link "python" in /usr/bin to point at "/usr/bin/python3.4" to "/usr/bin/python2.7".
Other thing is "mintMenu" the advanced start menu in the panel is now working again.

Error installing selenium python

Getting this error when running pip install -U selenium. Mid way through the script, it gets the following SyntaxError:
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "C:\Python32\Scripts\build\rdflib\setup.py", line 6, in <module>
from rdflib import __version__
File "rdflib\__init__.py", line 64, in <module>
from rdflib.term import URIRef, BNode, Literal, Variable
File "rdflib\term.py", line 367
except TypeError, te:
^
SyntaxError: invalid syntax
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "C:\Python32\Scripts\build\rdflib\setup.py", line 6, in <module>
from rdflib import __version__
File "rdflib\__init__.py", line 64, in <module>
from rdflib.term import URIRef, BNode, Literal, Variable
File "rdflib\term.py", line 367
except TypeError, te:
^
SyntaxError: invalid syntax
----------------------------------------
Command python setup.py egg_info failed with error code 1
Since it is a Syntax Error, I assume it is a python version problem, I'm running 3.2.2.
Pip did come with a pip-3.2.exe file, which I tried to run. But I got the same error. I'm pretty new to Python so it might be something simple.
And how can it be a syntaxError? pip is an already made program.
Running Win7, Python 3.2.2
Selenium does not support Python 3. Use Python 2.7 instead.
Sadly, almost all Python software requires Python 2.x.
[Update]
Selenium supports Python 3.x now.

Categories

Resources