【问题标题】:How to I point to a local copy of Python on a Linux Server?如何在 Linux 服务器上指向 Python 的本地副本?
【发布时间】:2018-06-27 21:19:32
【问题描述】:

我已将 Python 2.7.12 下载并编译到 Linux 服务器上的 $HOME 目录中。

目前,我无法将该版本的 python 设置到我的本地路径并成为默认版本,即使我现在已经在我的 .bash_profile 中添加了一个引用。见附件。

当我

 which python

我看到我被定向到 /usr/bin/python 中的默认 2.6 安装。

任何想法我做错了什么?您需要更多信息吗?

提前致谢!

【问题讨论】:

    标签: python linux server installation


    【解决方案1】:

    当您执行PATH=$PATH:$HOME/bin 时,您会将$HOME/bin 添加到您的PATH 变量的end 中(所以它是检查的最后一个 位置) .如果您希望此 python 成为优先级,则需要将其添加到您的PATH开头

    PATH=$HOME/bin:$PATH
    

    【讨论】:

    • 您好,非常感谢!我现在已经更新到 -PATH=$HOME/bin:$PATH PATH=$HOME/python/Python-2.7.12/:$PATH PYTHONPATH=$HOME/python/Python-2.7.12:$PATH export PATH export PYTHONPATH - 但在刷新 .bash_profile 并注销并重新登录后,默认仍然是其他安装。
    • 没关系!我想到了。一个小路径问题,但是,在您的帮助下,.bash_profile 语句现在是正确的。谢谢!
    • 很高兴你知道了!
    猜你喜欢
    • 2020-05-30
    • 2012-12-07
    • 1970-01-01
    • 1970-01-01
    • 2017-05-10
    • 2014-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多