默认python/usr/bin/python而不是/usr/local/bin/python [英] Default python /usr/bin/python instead of /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更改为python2.7而不是/usr/bin
上的pythn2.6,我想在python2.6下使用/usr/bin/python
.我已经尝试按照已经不起作用的方法进行操作.
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.
- 我创建了symlink并将其指向
/usr/bin
上的python 2.6 - 我已经在.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屋!