yum -y install gcc zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel git
2、安装pyenv
git clone https://github.com/yyuu/pyenv.git /opt/app/.pyenv/# 配置环境变量echo 'export PYENV_ROOT="/opt/app/.pyenv"' >> ~/.bash_profileecho 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profileif command -v pyenv 1>/dev/null 2>&1; then eval "$(pyenv init --path)"fisource ~/.bash_profile# 查看pyenv版本pyenv -v
3、使用pyenv
pyenv helpUsage: pyenv <command> [<args>]Some useful pyenv commands are: commands List all available pyenv commands exec Run an executable with the selected Python version global Set or show the global Python version(s) 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(s) 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(s) 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
4、使用pyen安装python
# 使用 pyenv install --List 查看可以安装的python版本,安装3.6.4版本pyenv install 3.6.4# 安装完成后目录所在/opt/app/.pyenv/versions# 查看可使用的版本,前面带*表示当前使用的版本pyenv versions# 查看当前使用的版本pyenv version
5、配置及管理python版本
# pyenv管理python版本的三个基础命令pyenv global <version>pyenv shelll <version>pyenv local <version># 使用pyenv global <version>配置当前用户的系统使用的python版本pyenv global 3.6.4python -V
总结
以上是内存溢出为你收集整理的安装pyenv全部内容,希望文章能够帮你解决安装pyenv所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)