---
title: "python2.7.2的安装"
author: "wind9984"
date: "2012-04-01T15:31:43Z"
tags: []
categories: ["编程语言"]
slug: "python2-7-2"
draft: false
lastmod: "2012-04-01T15:31:43Z"
id: 1472647
url: "https://ilikedo.iteye.com/blog/1472647"
---

安装python2.7的时候加入--enable-shared参数时,在make阶段会有一下错误

 

/usr/bin/ld: /usr/local/lib/libpython2.7.a(abstract.o): relocation R\_X86\_64\_32 against \`a local symbol' can not be used when making a shared object; recompile with -fPIC

/usr/local/lib/libpython2.7.a: could not read symbols: Bad value

collect2: ld returned 1 exit status

 

我的解决方法是make && make install 执行2遍就可以通过了,具体原因不知道...,以下是我的操作记录

 

\[root@vhost141 Python-2.7.2] ./configure --enable-shared

 

\[root@vhost141 Python-2.7.2]make && make install

 

\[root@vhost141 Python-2.7.2]whereis libpython2.7.so.1.0                                    
libpython2.7.so.1: /usr/local/lib/libpython2.7.so.1.0

 

\[root@vhost141 Python-2.7.2] vi /etc/ld.so.conf

 

include ld.so.conf.d/\*.conf  
/usr/local/lib/

 

\[root@vhost141 Python-2.7.2] /sbin/ldconfig

\[root@vhost141 Python-2.7.2] /sbin/ldconfig -v | grep libpython2.7.so

 

  libpython2.7.so.1.0 -&gt; libpython2.7.so.1.0