简体   繁体   English

在 Cent OS 5.8 上安装 Python 2.6.6 时出现 bz2 问题

[英]bz2 issue when installing Python 2.6.6 on Cent OS 5.8

I installed bzip2, bzip2-devel & bzip2-libs using the following command:我使用以下命令安装了 bzip2、bzip2-devel 和 bzip2-libs:

yum install bzip2 bzip2-devel bzip2-libs

Installation proceeded with to warning or error.安装继续进行到警告或错误。

After this step, I installed Python 2.6.6 using the following commands (note: I must install it this way and not using yum):完成此步骤后,我使用以下命令安装了 Python 2.6.6(注意:我必须以这种方式安装,而不是使用 yum):

wget http://www.python.org/ftp/python/2.6.6/Python-2.6.6.tgz
tar -xzvf Python-2.6.6.tgz
cd Python-2.6.6
./configure
make
make install

But on "make" step, I got the following error:但是在“制作”步骤中,出现以下错误:

Failed to build these modules: bz2无法构建这些模块:bz2

I tried installing Mercurial 2.0.2 afterward but got the following error:之后我尝试安装 Mercurial 2.0.2 但出现以下错误:

Couldn't import standard bz2 (incomplete Python install).无法导入标准 bz2(Python 安装不完整)。

Anyone knows what I'm doing wrong here?任何人都知道我在这里做错了什么?

Thx谢谢

I managed to fix my problem by adding --enable-shared option when configuring Python.我在配置 Python 时通过添加--enable-shared选项设法解决了我的问题。

./configure --enable-shared

Make sure you don't have mixed installation of Python.确保您没有混合安装 Python。 In my case, I had two installations就我而言,我有两个安装

/usr/local/bin/python and /usr/bin/python where by default it was using first one. /usr/local/bin/python/usr/bin/python默认情况下它使用第一个。

So I did: rm /usr/bin/python and it worked.所以我做了: rm /usr/bin/python并且它起作用了。

Or要么

You can also change the priority of which python in your $PATH.您还可以更改 $PATH 中which python的优先级。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM