美文网首页
centos8 pyenv 安装 python

centos8 pyenv 安装 python

作者: 不上进的码农 | 来源:发表于2020-11-10 10:35 被阅读0次

<meta charset="utf-8">

先安装git:

$ yum install git
了解官方手册,请移步:https://github.com/pyenv/pyenv

首先安装依赖包

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

安装pyenv 先看下面,根据系统输入命令

$ git clone https://github.com/pyenv/pyenv.git ~/.pyenv
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >>~/.bash_profile
$ echo 'eval "$(pyenv init -)"' >>~/.bash_profile
$ exec $SHELL -l #即是启动语句,重启系统执行这条语句

使用 pyenv 安装 python 时,默认从 python.org 下载指定版本,往往特别慢,经常下载失败,这时可以先从官网下载所需要的版本的源代码到 ~/.pyenv/cache 目录下,再执行安装命令(亲测很好用)。

注意这里要下载的是类似于 Python-3.7.3.tar.xz 这样的压缩文件,要到官网 sourcecode 页面 才可以下载。

加速

下载需要的版本放到~/.pyenv/cache文件夹下面
然后执行 pyenv install 版本号 安装对应的python版本
傻瓜式脚本如下,其中v表示要下载的版本号
v=3.7.3;wget https://npm.taobao.org/mirrors/python/\$v/Python-\$v.tar.xz -P ~/.pyenv/cache/;pyenv install $v

http://mirrors.sohu.com/python/ 搜狐镜像
https://npm.taobao.org/mirrors/python/ 淘宝镜像

基本命令

pyenv commands 查看pyenv命令
pyenv install --list 查看可安装的python版本
pyenv versions 查看已安装版本
pyenv version 查看当前使用的python版本
pyenv install -v 版本号 安装python
pyenv rehash 刷新python已安装列表
pyenv uninstall 版本号 删除python
pyenv global 版本号 设置当前全局python版本
pyenv local 版本号 设置局部python版本
pyenv local --unset 取消局部python版本设置,或者删除当前目录下的.python-version文件

pyenv help

witcomm@storage90:~$ pyenv help
Usage: pyenv <command> [<args>]

Some useful pyenv commands are:
   commands    List all available pyenv commands
   commands    List all available pyenv commands
   exec        Run an executable with the selected Python version
   global      Set or show the global Python version
   help        Display help for a command
   hooks       List hook scripts for a given pyenv command
   init        Configure the shell environment for pyenv
   install     Install a Python version using python-build
   local       Set or show the local application-specific Python version
   prefix      Display prefix for a Python version
   rehash      Rehash pyenv shims (run this after installing executables)
   root        Display the root directory where versions and shims are kept
   shell       Set or show the shell-specific Python version
   shims       List existing pyenv shims
   uninstall   Uninstall a specific Python version
   version     Show the current Python version and its origin
   --version   Display the version of pyenv
   version-file   Detect the file that sets the current pyenv version
   version-name   Show the current Python version
   version-origin   Explain how the current Python version is set
   versions    List all Python versions available to pyenv
   whence      List all Python versions that contain the given executable
   which       Display the full path to an executable

See `pyenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/pyenv/pyenv#readme

相关文章

  • python 安装

    1、pyenv管理 pyenv 让python环境完美切换 安装pyenv 安装 pyenv-virtualenv...

  • centos8 pyenv 安装 python

    先安装git: $ yum install git了解官方手册,请移步:https://github.com/py...

  • pyenv virtualenv使用

    mac python pyenv virtualenv pyenv 安装 使用brew安装:brew instal...

  • mac修改Python版本

    利用pyenv修改Python版本 安装 Homebrew 官网 安装pyenv 在.bash_profile...

  • python 新手入门

    1、安装pyenv 2、安装python 3、使用pyenv 4、vitrualenv 使用 5、ipython安...

  • python 多版本管理

    1、安装软件 2、设置环境变量 3、pyenv 安装python版本 4、pyenv使用

  • python相关镜像

    pyenv安装python版本 pip安装包

  • mac下安装pyenv

    pyenv配置 Homebrew安装pyenv 查看有哪些版本可供安装 安装 卸载 切换python版本 pych...

  • pyenv

    pyenv是python的多版本管理包,实现互相独立、互不干扰的python环境配置。 安装pyenv 安装电脑是...

  • Mac系统 使用 pyenv 管理 python版本

    1.安装pyenvbrew install pyenv2.查看当前已安装的 python 版本pyenv vers...

网友评论

      本文标题:centos8 pyenv 安装 python

      本文链接:https://www.haomeiwen.com/subject/pmbdbktx.html