Linux:无需安装即可运行Python

问题描述 投票:0回答:2

我公司服务器安装Redhat 6,默认Python 2.6。客户给我发了一些使用Python 3.4的示例代码,但我没有安装Python 3.4的权限

使用Java,我可以将jdk安装文件夹从另一台Linux服务器复制到我的而不安装它。我需要做的唯一更改就是相应地更改 JAVA_HOME 和 PATH 变量

如何将这种方式应用于Python?

java python linux installation portable-executable
2个回答
10
投票

前往

python.org
下载其源代码,例如“Python-3.4.6.tar.xz”,然后解压,将目录更改为根目录并运行此脚本:

./configure; make

这里还有一个shell脚本,你可以运行它。

# get-python3.sh
wget https://www.python.org/ftp/python/3.4.6/Python-3.4.6.tar.xz
tar xvfJ Python-3.4.6.tar.xz
cd Python-3.4.6
./configure
make

最后,你可以通过

./python
命令运行python。

这是输出:

Python 3.4.6 (default, Mar 20 2017, 20:03:28) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

0
投票

Togtokh Khorchin 的解决方案出现以下错误: 致命错误:ffi.h:没有这样的文件或目录

© www.soinside.com 2019 - 2024. All rights reserved.