Ubuntu包需要编译Python 2.7

前端之家收集整理的这篇文章主要介绍了Ubuntu包需要编译Python 2.7前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图在Ubuntu 10.4上编译 Python 2.7,但是在运行make后会收到以下错误消息:
  1. Python build finished,but the necessary bits to build these modules were not found:
  2. _bsddb bsddb185 sunaudiodev
  3. To find the necessary bits,look in setup.py in detect_modules() for the module's name.

我需要什么包? (setup.py无效)

假设您已经安装了所有依赖项(在Ubuntu上,这将是一堆诸如sudo apt-get install libdb4.8-dev和各种其他的-dev软件包,那么我是如何构建Python的.
  1. tar zxvf Python-2.7.1.tgz
  2. cd Python-2.7.1
  3.  
  4. # 64 bit self-contained build in /opt
  5. export TARG=/opt/python272
  6. export CC="gcc -m64"
  7. export LDFLAGS='-Wl,-rpath,\$${ORIGIN}/../lib -Wl,-rpath-link,--enable-new-dtags'
  8. ./configure --prefix=$TARG --with-dbmliborder=bdb:gdbm --enable-shared --enable-ipv6
  9. make
  10. make install

在制作过程中不建立的唯一模块有:

  1. _tkinter - I don't do GUI apps and would use wxWindows if I did
  2. bsddb185 - horribly obsolete version of bdb
  3. dl - deprecated in 2.6
  4. imageop - deprecated in 2.6
  5. sunaudiodev - obsolete interface to some SparcStation device I think

接下来,我收集任何尚未安装在Python安装目录中的.so文件,然后将其复制:

  1. # collect binary libraries ##REDO THIS IF YOU ADD ANY ADDITIONAL MODULES##
  2. cd /opt/python272
  3. find . -name '*.so' | sed 's/^/ldd -v /' >elffiles
  4. echo "ldd -v bin/python" >>elffiles
  5. chmod +x elffiles
  6. ./elffiles | sed 's/.*=> //;s/ .*//;/:$/d;s/^ *//' | sort -u | sed 's/.*/cp -L & lib/' >lddinfo
  7. # mkdir lib
  8. chmod +x lddinfo
  9. ./lddinfo

然后添加setuptools的很好的措施

  1. #set the path
  2. export PATH=/opt/python272/bin:$PATH
  3.  
  4. #install setuptools
  5. ./setuptools-0.6c11-py2.7.egg

在这一点上,我可以使用/ opt / python272的tarball,并在任何64位的Linux发行版上运行,甚至是一个没有安装任何依赖关系的剥离版,也可以是旧的旧版旧版本的依赖关系.

我也得到点安装,但在这一点上,由于与virtualenv的一些失败的斗争,笔记中有一个缺口.基本上virtualenv不支持这种情况.大概我做了easy_install点,然后:

  1. export LD_RUN_PATH=\$${ORIGIN}/../lib
  2. pip install cython
  3. pip install {a whole bunch of other libraries that I expect to use}

完成安装模块后,我返回并重新运行命令来收集.so文件,并创建一个新的tarball.有几个包,我不得不用LDFLAGS来处理它们,以使它们正确安装,而且我还没有做足够的彻底的测试,但到目前为止,它的工作原理是,我使用这个Python构建来运行生产应用程序未安装所有支持库的计算机.

猜你在找的Ubuntu相关文章