I have installed Python on an offline server but I cannot install pip
this is what I have done :
1 ) Download the archive file pip-21.3.1.tar.gz
and put it on my offline Linux server. extract the archive file.
2 ) cd pip-21.3.1
3 ) Run python3 setup.py install
and this is the error that I get :
ModuleNotFoundError: No module named 'setuptools'
CodePudding user response:
That's because you need to install setuptools
- which is the separate module.
Alternative (and prefered) solution would be to install pip3
using rpm
packages (here's seems to be instruction for that:
https://access.redhat.com/solutions/6996
CodePudding user response:
You might try using ensurepip
if you have python3.4
or newer, as it
...does not access the internet. All of the components needed to bootstrap
pip
are included as internal parts of the package.
in your case
python3 -m ensurepip
should suffice
CodePudding user response:
You already got an answer on how to solve the problem. The reason why you need to install setuptools
is that pip's setup.py
starts with:
import os
import sys
from setuptools import find_packages, setup
As you can see the last line tries to import from setuptools that is not from the standard library.
If the Python you're using is the one that has been installed with rpm
, go and use rpm
as already suggested. If the Python has been custom installed, that command may not solve yout problem: suppose you installed Python 3.9 and system Python is 3.7, the site-package directory would be different.