Ubuntu16.04安装pyenv 及报错解决方案

按照GitHub上的教程:

  • 安装之前要限安装curl 和git-core:
sudo apt-get install curl git-core
  • 接着开始正式安装:
$ curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
  • 安装完成后,根据提示将如下语句加入到 ~/.bashrc 中:

不知道为什么我直接复制语句到~/.bashrc一直无效,故通过命令行方式添加:

$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
$ source ~/.bash_profile

这后面一定记得加上source ~/.bash_profile,否则会报错,no command ‘pyenv’ found, did you mean ……

(注:这里也有的教程是将上面的“bash_profile”换成“bashrc”,我安装的时候两者都配置了,总之能用了,如果用bash_profile不行的话,换成bashrc”试试看)

  • 试着运行pyenv –version,没有报错,接着安装Python

  • 安装Python3.5.2:

由于直接执行 pyenv install 3.5.2,网络下载速度太慢,选择复制链接到网页直接下载,并将下载包复制到~/.pyenv/cache, 这里的cache 是自己新建的文件夹,复制过来后重新运行 pyenv install 3.5.2

  • 报错:
 Ignoring ensurepip failure: pip 8.1.1 requires SSL/TLS

解决方案:

apt-get install libssl-dev
  • 重新安装,此时出现warning信息如下:
WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
warning: …………

解决方案:(需要安装相关依赖)

sudo apt-get install libbz2-dev libreadline-dev libsqlite3-dev

你可能感兴趣的:(配置安装遇到的问题)