I have some old code I'm trying to use which uses httplib2 Python lib. The same exact code works fine on Linux (e.g. Raspberry Pi).
I have used pip to uninstall the httplib2 lib and pip3 to re-install.
Here's what "pip list" (or "pip3 list") shows:
C:\Users\g7847>pip list
Package Version
----------------------- ---------
bcrypt 3.2.0
cachetools 4.2.4
certifi 2021.5.30
cffi 1.15.0
chardet 4.0.0
cryptography 36.0.0
cycler 0.10.0
google-auth 2.3.3
google-auth-httplib2 0.1.0
httplib2 0.20.2
idna 2.10
kiwisolver 1.3.1
matplotlib 3.4.2
numpy 1.21.0
paramiko 2.8.1
Pillow 8.3.1
pip 21.3.1
pyasn1 0.4.8
pyasn1-modules 0.2.8
pycparser 2.21
PyNaCl 1.4.0
pyparsing 2.4.7
python-dateutil 2.8.2
requests 2.25.1
requests-http-signature 0.2.0
rsa 4.8
setuptools 57.1.0
six 1.16.0
urllib3 1.26.6
wheel 0.36.2
C:\Users\g7847>
and yet:
C:\Users\g7847>python3 sshConnect.py
Traceback (most recent call last):
File "C:\Users\g7847\sshConnect.py", line 12, in <module>
import httplib2
ModuleNotFoundError: No module named 'httplib2 '
This is the import section at the beginning. The only library that is complained about is httlib2.
import json
import time
import subprocess
import datetime
import base64
import sys
import os
import getpass
import errno
import re
import string
import httplib2
CodePudding user response:
pip and pip3 are not the same.
pip will use one of your Python versions depending on what exactly is first in the system PATH variable, whereas with pip3 you can be sure that the module will be installed in python3 library.
So, could you double check if the module is actually installed in the python3 library ?
If the module really is installed in python3 library, you could check if the PATH variable is correct. (You can check the PATH by using the following : Reference)
CodePudding user response:
The httplib2 library is part of the standard library in Python 3.
import httplib ImportError: No module named httplib
is it installed on version 2.x?
pip2 install httplib2