【问题标题】:Linux: Run Python without installationLinux:无需安装即可运行 Python
【发布时间】:2017-03-20 03:56:35
【问题描述】:

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

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

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

【问题讨论】:

标签: java python linux installation portable-executable


【解决方案1】:

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.
>>> 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-12-14
    • 1970-01-01
    • 1970-01-01
    • 2011-04-25
    • 2011-03-11
    • 2013-09-09
    • 2017-01-31
    • 1970-01-01
    相关资源
    最近更新 更多