[英]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.我有一个开发Linux服务器 (RHEL),它没有任何我们需要开发 python 应用程序的 inte.net 连接。 I can connect to this dev box from my local Windows server where I have inte.net connection.
我可以从具有 inte.net 连接的本地Windows服务器连接到此开发箱。
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.我需要在此开发箱上安装python-3.75和一些其他软件包(其中一些需要 gcc 编译器和其他依赖项)。
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?考虑到某些软件包会有很多依赖关系并且开发箱上没有 inte.net,最好的方法是什么?
Some options that the inte.net research suggests for package installation are: inte.net 研究为 package 安装建议的一些选项是:
Download the packages using PIP DOWNLOAD on the local server > copy the package tar to the dev server > pip install package
使用 PIP 在本地服务器上下载包 > 将 package tar 复制到开发服务器 >
pip install package
download and unpack the source distribution > using the setup.py file of the package: run python setup.py install --user
下载并解压源分发 > 使用 package 的 setup.py 文件:运行
python setup.py install --user
Install using Wheels: Find the wheel for the package > upload it to the dev server > run pip install SomePackage.whl
使用 Wheels 安装:找到 package 的 wheel > 将其上传到开发服务器 > 运行
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.
您可以通过此过程使用 VMware 或 VirtualBox 到 go。 Steps below are the ones that you should do on server with inte.net connection .
以下步骤是您应该在具有 inte.net 连接的服务器上执行的步骤。
First, we go to https://www.python.org/downloads/source/ and find our required version of python and download Gzipped source tarball of it.首先,我们从 go 到https://www.python.org/downloads/source/并找到我们所需的 python 版本并下载它的 Gzip 源压缩包。
Then we copy downloaded file to our target machine.然后我们将下载的文件复制到我们的目标机器。 You can copy using command below.
您可以使用下面的命令进行复制。
scp file username@ipaddress:dir scp文件 用户名@ip地址:目录
Then go to your specified dir and make sure the file has copied successfully.然后 go 到您指定的目录并确保文件已成功复制。 Now you can unzip the file using command below:
现在您可以使用以下命令解压缩文件:
Tar -xvf file_name焦油 -xvf 文件名
Now go to unzipped folder which has configure file in it.现在 go 解压到其中有配置文件的文件夹。 And run command below:
并运行以下命令:
./configure 。/配置
This step needs inte.net connection.此步骤需要 inte.net 连接。
Step 4 should create some files including make files.第 4 步应该创建一些文件,包括 make 文件。 Now in your current directory run command below:
现在在您当前的目录中运行以下命令:
make制作
After having make process, go back to your previous directory and zip the directory which has make files in it.完成制作过程后, go 回到你之前的目录, zip 回到里面有制作文件的目录。 You can zip using command below:
您可以使用以下命令拨打 zip:
tar -czf焦油-czf
We are going to copy this file to our target machine which doesn't have inte.net connection.我们将把这个文件复制到没有 inte.net 连接的目标机器上。
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.现在你可以 go 到你复制压缩文件的目标机器和目录,是时候使用 tar 命令解压缩你的文件了。 Once you unzipped your file go to your directory which has make files in it and run command below:
将文件 go 解压缩到包含 make 文件的目录并运行以下命令后:
make install
it should begin to install Python with its dependencies.它应该开始安装 Python 及其依赖项。 You can type python3.8 –version to make sure that your python is installed.
您可以键入 python3.8 –version 以确保您的 python 已安装。 (Instead of 3.8 type your own version)
(而不是 3.8 键入您自己的版本)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.