English 中文(简体)
如何解除安装 Python2.6
原标题:How to uninstall Python2.6

我的Fedora11机器上装有Python2.6 的预装设备, 我成功地安装了python 2.7, 使用了以下步骤:

wget http://www.python.org/ftp/python/2.7/Python-2.7.tar.bz2
tar -xvjf Python-2.7.tar.bz2
cd Python*
./configure --prefix=/opt/python27
make
make install
vi ~/.bash_profile
## replaced PATH=$PATH:$HOME/bin
## with PATH=$PATH:$HOME/bin:/opt/python27/bin

## reload .bash_profile
source ~/.bash_profile
echo "/opt/python27/lib" > /etc/ld.so.conf.d/python27.conf
ldconfig

然而,当我检查Python版本时,该系统通过终端(python-V)使用,仍然显示python2.6。

How will I make the system use python2.7 as its default python? Or if possible, how will I uninstall python2.6?

提前感谢!

问题回答

卸载系统 Python 是一个坏主意。 有许多其他软件包和软件都依赖它。 您最好使用 python2. 7, 修改 $PATH 或创建别名, 如 python2. 7, 指向您安装在 /opt dir 中的 python 。

拆卸Fedora提供的python 2. 6 提供的python 可能会打破许多取决于它的包件。 我建议你不要这样做。

现在,您的问题只是 $PATH 和类似的变量 ( $MAN_PATH etc. > ) 被从左到右搜索。 您在 < code>/ opt/ python27/ bin 之后附加了您新的 < em > 标准位置, 如 < code>/ usr/ bin 。 反转顺序, 您将获得 opt/ python27/ bin/ python 默认的 python 二进制。

首先 - 永远不要试图在 RHEL/CentOS/Fedora 上卸载 Python 。 yum 是以 Python 书写的,修复系统会遇到许多问题。

如果您想要默认使用 Python2.7 系统, 请查找 Python2. 6 (使用 < code > phython 或 < code> 哪个 python 命令) 的二进制文件的位置, 备份它, 用 Python2. 7 的二进制文件替换它 。

代替不安装旧版本的旧版本, 在使用 python 时使用特定版本

我改变了符号链接

ln -s /usr/local/bin/python2.7 /usr/local/bin/python

使用

python -m pip install pip --upgrade




相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签