Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I test that I have a Python module successfully installed?

I tried to install beautifulsoup. I get such an error:
<-- snip -->

raise MissingSectionHeaderError(fpname, lineno, line)
ConfigParser.MissingSectionHeaderError: File contains no section headers.
file: /Users/Sam/.pydistutils.cfg, line: 1
'install_lib = ~/Library/Python/$py_version_short/site-packages\n'

I get an similar error as I run my Python code in vim by: :!python %

like image 751
Léo Léopold Hertz 준영 Avatar asked Mar 08 '26 05:03

Léo Léopold Hertz 준영


1 Answers

You can test if a module is installed like so:

$ python
>>> import modulename
like image 156
defrex Avatar answered Mar 10 '26 17:03

defrex