Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install the 'glob' module?

Tags:

python

glob

ros

I am running ubuntu 14.04 and trying to launch ROS Simulator. I have this error:

ImportError: No module named 'glob'

Installing glob2 does not solve the problem.

python -m site output:

sys.path = [
    '/home/omar',
    '/opt/ros/indigo/lib/python2.7/dist-packages',
    '/home/omar/anaconda3/lib/python35.zip',
    '/home/omar/anaconda3/lib/python3.5',
    '/home/omar/anaconda3/lib/python3.5/plat-linux',
    '/home/omar/anaconda3/lib/python3.5/lib-dynload',
    '/home/omar/anaconda3/lib/python3.5/site-packages',
    '/home/omar/anaconda3/lib/python3.5/site-packages/Sphinx-1.4.6-py3.5.egg',
    '/home/omar/anaconda3/lib/python3.5/site-packages/numba-0.29.0-py3.5-linux-x86_64.egg',
    '/home/omar/anaconda3/lib/python3.5/site-packages/glob2-0.4.1-py3.5.egg',
    '/home/omar/anaconda3/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg',
]
USER_BASE: '/home/omar/.local' (exists)
USER_SITE: '/home/omar/.local/lib/python3.5/site-packages' (doesn't exist)
ENABLE_USER_SITE: True
like image 299
Omar Amr Avatar asked Mar 22 '17 23:03

Omar Amr


People also ask

Do you need to pip install glob?

The only thing that you need for installing the glob module on Windows are: Python. PIP or Conda (depending upon user preference)

Do we need to install glob?

glob is part of the Python Standard Library, it thus comes pre-installed with Python, whether you run Python on Windows, macOS, Linux, or whatever..

Is glob installed by default?

Introduction to glob Module in Python The glob module in Python does not require separate installations and comes with every default Python installation.


2 Answers

For python 2.7:

pip install glob2

For python 3.7:

pip3 install glob2

like image 178
Ishan Khatri Avatar answered Oct 03 '22 20:10

Ishan Khatri


For Python 3, there is no glob3.

So use:

sudo pip3 install glob2
like image 30
H.A. R Avatar answered Oct 03 '22 21:10

H.A. R