我的linuxbox上有两个版本的python:
$python
Python 2.6.6 (r266:84292, Jul 10 2013, 22:48:45)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
$ /usr/local/bin/python2.7
Python 2.7.3 (default, Oct 8 2013, 15:53:09)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
$ which python
/usr/bin/python
$ ls -al /usr/bin/python
-rwxr-xr-x. 2 root root 4864 Jul 10 22:49 /usr/bin/python
Run Code Online (Sandbox Code Playgroud)
我怎样才能使2.7成为默认版本,所以当我输入python它时我会把它放到2.7?
我正在尝试安装PyQueryvia pip但是我收到了一个我不明白的错误.我使用的命令是:
sudo pip install pyquery
Run Code Online (Sandbox Code Playgroud)
我得到以下输出:
Requirement already satisfied (use --upgrade to upgrade): pyquery in /usr/local/lib/python2.7/dist-packages
Downloading/unpacking lxml>=2.1 (from pyquery)
Running setup.py egg_info for package lxml
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.3.0.
Building without Cython.
ERROR: /bin/sh: 1: xslt-config: not found
** make sure the development packages of libxml2 and libxslt are installed **
Using build configuration of libxslt
Downloading/unpacking cssselect (from pyquery)
Running setup.py egg_info for package cssselect
no previously-included …Run Code Online (Sandbox Code Playgroud) 我的 CentOS 机器中安装了 python2.6 和 python2.7。python2.6安装在/usr/bin/python,我已经从位置的源安装了python2.7/usr/local/bin/python
安装后我的默认 python 更改为 python2.7 而不是 pythn2.6 at /usr/bin,我想使用 python 2.6 at /usr/bin/python。我已经尝试过以下事情已经没有任何效果。
/usr/bin请让我知道如何安装 python 2.7 和 2.6,并将 python 2.6 作为我的默认版本。我的 arch linux 盒子也有同样的事情,但这不适用于我的 centos 盒子。
附上我的 .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 …Run Code Online (Sandbox Code Playgroud)