默认 python/usr/bin/python 而不是/usr/local/bin/python [英] Default python /usr/bin/python instead of /usr/local/bin/python

查看:27
本文介绍了默认 python/usr/bin/python 而不是/usr/local/bin/python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 CentOS 机器中同时安装了 python2.6 和 python2.7.python2.6 安装在 /usr/bin/python 并且我已经从位置 /usr/local/bin/python

I have both python2.6 and python2.7 installed in my CentOS box. python2.6 is installed at /usr/bin/python and i have installed python2.7 from source at location /usr/local/bin/python

安装后我的默认python在/usr/bin改为python2.7而不是pythn2.6,我想在/usr/bin/python<使用python 2.6/代码>.我已经尝试过以下事情,但没有任何效果.

after the installation my default python is changed to python2.7 instead of pythn2.6 at /usr/bin, I want to use python 2.6 at /usr/bin/python. I have tried following things already nothing worked.

  1. 我创建了符号链接,并在 /usr/bin
  2. 将其指向 python 2.6
  3. 我已在 .bash_profile 中修改了我的默认 python 路径,但仍然无法正常工作

请告诉我如何安装 python 2.7 和 2.6 以及 python 2.6 作为我的默认版本.我在我的 arch linux 机器上也有同样的事情,但这不适用于我的 centos 机器.

Please let me know how can i have python 2.7 installed along with 2.6 installed and python 2.6 as my default version. I have the same thing working with my arch linux box, but this doesn't work with my centos box.

附加我的 .bash_profile,

Attaching my .bash_profile,

# .bash_profile

export _BASH_PROFILE=1

# Get the aliases and functions
if [ -z "$_BASHRC" ]; then
        . ~/.bashrc
fi

unset _BASH_PROFILE

# User specific environment and startup programs

PATH=$PATH:$HOME/bin
BASH_ENV=$HOME/.bashrc
USERNAME=""

export USERNAME BASH_ENV PATH

export user=$(/usr/bin/whoami)
export WK_PORT=8086
export WK_PATH=ADC

# For DEV accounts change PYDOC_PORT value to 7400 + webkit number. For
# example WK23 would be port number 7423
export PYDOC_PORT=7464


alias serve="python -m SimpleHTTPServer"


unset _BASH_PROFILE

# User specific environment and startup programs

PATH=$PATH:$HOME/bin
BASH_ENV=$HOME/.bashrc
USERNAME=""

export USERNAME BASH_ENV PATH

export user=$(/usr/bin/whoami)
export WK_PORT=8086
export WK_PATH=ADC

# For DEV accounts change PYDOC_PORT value to 7400 + webkit number. For
# example WK23 would be port number 7423
export PYDOC_PORT=7464


alias serve="python -m SimpleHTTPServer"


PYTHONPATH="$PYTHONPATH:/usr/bin/python"

推荐答案

我也遇到了同样的问题.以下命令修复了它:

I had the same problem. The following command fixed it:

sudo ln -sf /usr/bin/python /usr/local/bin/python

这将从 /usr/local/bin/python --> /usr/bin/python 创建一个符号链接.引用自此处

This will make a symbolic link from /usr/local/bin/python --> /usr/bin/python. Referred from here

这篇关于默认 python/usr/bin/python 而不是/usr/local/bin/python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆