简体   繁体   中英

Install Python Packages and dependencies on Linux without Internet

I have a dev Linux server (RHEL) which doesn't have any inte.net connectivity where we need to develop a python application. I can connect to this dev box from my local Windows server where I have inte.net connection.

I would need to install python-3.75 and some other packages (some of which need gcc compilers and other dependencies) on this dev box.

What is the best way to do this considering that some packages will have many dependencies and there is no inte.net on the dev box?

Some options that the inte.net research suggests for package installation are:

  1. Download the packages using PIP DOWNLOAD on the local server > copy the package tar to the dev server > pip install package

  2. download and unpack the source distribution > using the setup.py file of the package: run python setup.py install --user

  3. Install using Wheels: Find the wheel for the package > upload it to the dev server > run pip install SomePackage.whl

Please let me know which one of these is good considering the limitations and kindly suggest if there is any other option as well.

Its kinda late but for those who may need it:

To start installing we need a virtual online server to download and configure file. You can use VMware or VirtualBox to go through this procedure. Steps below are the ones that you should do on server with inte.net connection .

  1. First, we go to https://www.python.org/downloads/source/ and find our required version of python and download Gzipped source tarball of it.

  2. Then we copy downloaded file to our target machine. You can copy using command below.

    scp file username@ipaddress:dir

  3. Then go to your specified dir and make sure the file has copied successfully. Now you can unzip the file using command below:

    Tar -xvf file_name

  4. Now go to unzipped folder which has configure file in it. And run command below:

    ./configure

This step needs inte.net connection.

  1. Step 4 should create some files including make files. Now in your current directory run command below:

    make

  2. After having make process, go back to your previous directory and zip the directory which has make files in it. You can zip using command below:

    tar -czf

We are going to copy this file to our target machine which doesn't have inte.net connection.

  1. Copy zipped file using scp command to your target machine.

Now you can go to your target machine and directory that you copied zipped file and it's time to unzip your file using tar command. Once you unzipped your file go to your directory which has make files in it and run command below:

make install

it should begin to install Python with its dependencies. You can type python3.8 –version to make sure that your python is installed. (Instead of 3.8 type your own version)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM