How to install the 'glob' module?
99,620
Solution 1
For python 2.7:
pip install glob2
For python 3.7:
pip3 install glob2
Solution 2
For Python 3, there is no glob3
.
So use:
sudo pip3 install glob2
Related videos on Youtube
Author by
Omar Amr
Updated on July 09, 2022Comments
-
Omar Amr almost 2 years
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
-
Ry- about 7 years
glob
is a standard module. Which version of Python are you using? -
Omar Amr about 7 yearsPython 3.5.2 Some solutions recommended reinstalling Ubuntu, but i'm keeping that as plan B.
-
wim about 7 yearsPlease include the output of
python -m site
-
Omar Amr about 7 years@wim I added it to the question
-
AmiNadimi over 3 yearsglob is part of the Standard Library in Python so you do not need to install it
-
Admin almost 3 yearsThe accepted answer is wrong. See the comments on the accepted answer.
-
-
Skyler Wiernik about 4 yearsYou really shouldn't sudo install packages for security purposes.
-
J. Tylka over 3 yearseven for pip3 it's still glob2, not glob3 :-D
-
Admin almost 3 yearsYou should not do sudo pip install.
pip3 install package_name
works fine. -
PeJota almost 3 years@SkylerWiernik what are the security concerns of using sudo for installation?
-
Skyler Wiernik almost 3 years@PedroMartinez you are giving the installation scripts of the package you are installing route access. If you were to install a malicious package (through something such as a type-o) you could potentially give hackers full access to your entire machine.
-
gshpychka over 2 yearsYou shouldn't sudo install anything, that's a bad practice and a security risk.
-
JavadMH13 over 2 yearsI try that on some distributions and get (Access Denied) Error.