Requirements:

  • Ubuntu/Debian:
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils
  • Fedora/CentOS/RHEL:

FIXME: you may need to install xz to build some CPython version

yum install zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel
  • Mac OS X:
brew install readline xz

NOTE: libssl-dev is required when compiling Python, installing libssl-dev will actually install zlib1g-dev, which leads to uninstall and re-install Python versions (installed before installing libssl-dev). On Redhat and derivatives the package is named openssl-devel.

Removing a python version

rm -rf ~/.pyenv/versions/2.7.5

Installing a 32 bit python on 64 bit Mac OS X (this will not work on Linux)

CONFIGURE_OPTS="--with-arch=i386" CFLAGS="-arch i386" LDFLAGS="-arch i386" python-build options

Installing a system-wide Python

If you want to install a Python interpreter that's available to all users and system scripts (no pyenv), use /usr/local/ as the install path. For example:

sudo python-build 3.3.2 /usr/local/

Make your pythons a little faster

You can set your CFLAGS to accepted safe values to help get a little more speed.

CFLAGS='-O2'

Build failed - bad interpreter: Permission denied

If you encounter this error while installing python and your server is a VPS, the /tmp directory where python-build download and compile the packages is probably mounted as noexec. You can check with your hosting provider if wether they provide a way to bypass this protection.

If the answer is no, just set the $TMPDIR environment variable to wherever you have a write + execution rights. For example:

export TMPDIR="$HOME/src"

Please note you'll have to do it every time you'll want to install a new version of python unless you write this command in your ~/.bashrc.

Build failed

If you've got something like that:

$ pyenv install 2.7.5
Downloading http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz...
Installing yaml-0.1.4... BUILD FAILED

Please, be sure to have "make" installed ($ sudo apt-get install make). On Ubuntu Server, by default, it doesn't.

Build failed: "ERROR: The Python zlib extension was not compiled. Missing the zlib?"

Installing Python-2.7.7...

ERROR: The Python zlib extension was not compiled. Missing the zlib?

Please consult to the Wiki page to fix the problem.
https://github.com/yyuu/pyenv/wiki/Common-build-problems BUILD FAILED
  • On Mac OS X 10.9, 10.10 and 10.11 you may need to set the CFLAGS environment variable when installing a new version in order for configure to find the zlib headers (XCode command line tools must be installed first):
CFLAGS="-I$(xcrun --show-sdk-path)/usr/include" pyenv install -v 2.7.7
  • Alternatively, try reinstalling XCode command line tools for your OS (especially if you just upgraded your OS)
xcode-select --install

ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

  • If you have homebrew openssl and pyenv installed, you may need to tell the compiler where the openssl package is located:
CFLAGS="-I$(brew --prefix openssl)/include" \
LDFLAGS="-L$(brew --prefix openssl)/lib" \
pyenv install -v 3.4.3

or (checked on RHEL6):

CFLAGS=-I/usr/include/openssl \
LDFLAGS=-L/usr/lib64 \
pyenv install -v 3.4.3
  • Alternatively, if you installed openssl with macports, use the following paths:
CFLAGS="-I/opt/local/include/" \
LDFLAGS="-L/opt/local/lib/" \
pyenv install -v 3.4.3
  • On FreeBSD 10-RELEASE and 11-CURRENT, you may need to recompile security/openssl without SSLv2 support. (See #464).

python-build: definition not found

To update your python-build definitions:

If you have python-build installed as an pyenv plugin:

$ cd ~/.pyenv/plugins/python-build && git pull

在Ubuntu上安装pyenv 相关问题Common build problems的更多相关文章

  1. 在Ubuntu上安装pyenv

    因为找到一个域名枚举的脚本使用Python3编写的,而我一直习惯的是使用Python2.7,在自己的Windows7上再安装个Python怕混了,于是想着在VPS上装个Python的版本管理工具,也方 ...

  2. 在ubuntu上安装pyenv出现的问题

    1.安装完pyenv时,并没有出现问题.但在安装python3.6.1时报错: ERROR: The Python ssl extension was not compiled. Missing th ...

  3. ubuntu上安装mysql 编译安装

    为什么要折腾?首先说明的是ubuntu上安装mysql等软件是非常容易简单的,其简单的程度盖过windows上的安装,一句sudo apt-get install就可以搞定.如果想用最简便的方法安装m ...

  4. 使用PPA在Ubuntu上安装php5.4~5.6,7

    使用PPA在Ubuntu上安装php5.4~5.6,7 sudo apt-get install software-properties-common sudo add-apt-repository ...

  5. 在 Ubuntu 上安装 TensorFlow (官方文档的翻译)

    本指南介绍了如何在 Ubuntu 上安装 TensorFlow.这些指令也可能对其他 Linux 变体起作用, 但是我们只在Ubuntu 14.04 或更高版本上测试了(我们只支持)  这些指令. 一 ...

  6. 在Ubuntu上安装openResty #1

    在Ubuntu上安装openResty #1 OpenResty® 是一个基于 Nginx 与 Lua 的高性能 Web 平台,其内部集成了大量精良的 Lua 库.第三方模块以及大多数的依赖项.用于方 ...

  7. [异常解决] ubuntu上安装JLink驱动遇到的坑及给后来者的建议

    一.前言 最近将整个电脑格式化,改成了linux操作系统 希望这样能让自己在一个新的世界探索技术.提升自己吧- win上的工具用多了,就不想变化了- 继上一篇<ubuntu上安装虚拟机遇到的问题 ...

  8. Ubuntu上安装Robomongo及添加到启动器

    到目前为止,Robomongo仍是MongoDB最好的客户端管理工具,如需在Ubuntu上安装Robomongo,可直接从官网下载.tar.gz压缩包进行解压,然后直接运行bin目录下的robomon ...

  9. 在 Ubuntu 上安装 Android Studio

    在 Ubuntu 上安装 Android Studio http://www.linuxidc.com/Linux/2013-05/84812.htm 打开terminal,输入以下命令 sudo a ...

随机推荐

  1. 都铎王朝第一至四季/全集The Tudors迅雷下载

    都铎王朝 第一.二.三.四季 The Tudors Season (2007-2010) 本季看点:本剧讲述了年轻的亨利八世对英国的统治以及他的婚姻生活,带有传奇色彩.Showtime电视台的古装热门 ...

  2. Javascrip获取页面URL信息

    使用Javascript可以方便获得页面的参数信息,常用的几种如下: 设置或获取对象指定的文件名或路径 window.location.pathname   设置或获取整个 URL 为字符串 wind ...

  3. 解决appcompat中各种奇葩的错误

    一.依赖/脱离appcompat 在新版本中Google跟新了一个依赖包,这个包包含了v4和v7的东西(v7是要依赖v4这个包的,所以用到v7时必须用一起的v4),只要你的编译版本compile wi ...

  4. [转]在Windows中安装PhpUnit

    FROM : http://www.cnblogs.com/heiing/archive/2012/09/07/2674807.html 步骤: 安装 pear ,参见http://www.cnblo ...

  5. junit5了解一下

    要求java8及以上版本 JUnit 5 = JUnit Platform + JUnit Jupiter + JUnit Vintage https://junit.org/junit5/docs/ ...

  6. 关于Base64编码的理解

    版权声明:本文为[viclee]原创,如需转载请注明出处~ https://blog.csdn.net/goodlixueyong/article/details/52132250 之前在很多业务中都 ...

  7. Understanding Linux CPU stats

    Your Linux server is running slow, so you follow standard procedure and run top. You see the CPU met ...

  8. lftp命令

    lftp 是一个功能强大的下载工具,它支持访问文件的协议: ftp, ftps, http, https, hftp, fish.(其中ftps和https需要在编译的时候包含openssl库).ll ...

  9. Log4cplus使用指南

    1.  Log4cplus简介 log4cplus是C++编写的开源的日志系统,前身是java编写的log4j系统,受Apache Software License保护,作者是Tad E. Smith ...

  10. Html 列表 li ul使用

    html中偶尔会使用到列表,记录一下. <!DOCTYPE html> <html> <head> <meta charset="UTF-8&quo ...