简体   繁体   English

用自制软件安装特定版本的python2

[英]Install specific version of python2 with homebrew

I've installed python 2.7.13 with homebrew but I need 2.7.10. 我用自制软件安装了python 2.7.13,但我需要2.7.10。 It seems something trivial... I've seen similar questions like this or this but I haven't been able to install it. 似乎一些小事......我看到了这样类似的问题还是这个 ,但我一直没能安装它。

I've tried to tap homebrew/versions and then do brew search python but there are no versions (rather than python2 and python3). 我试图点击homebrew/versions ,然后做brew search python但没有版本(而不是python2和python3)。

Homebrew doesn't do this, I would recommend using homebrew to install pyenv and then using pyenv to install and use python 2.7.10, and any other versions you need. Homebrew不这样做,我建议使用自制软件安装pyenv ,然后使用pyenv安装和使用python 2.7.10,以及您需要的任何其他版本。

Get pyenv: 获取pyenv:

brew update
brew install pyenv

Then add eval "$(pyenv init -)" to your .bash_profile and relaunch terminal. 然后将eval "$(pyenv init -)".bash_profile并重新启动终端。

Install python 2.7.10: 安装python 2.7.10:

pyenv install 2.7.10

You can then set 2.7.10 as the global python by using pyenv global 2.7.10 but I would instead recommend you look at the pyenv virtualenv or pyenv virtualenvwrapper projects and use a python virtual environment for your code, or set the python for your project folder only by cd 'ing to your project folder and using pyenv local 2.7.10 . 然后你可以使用pyenv global 2.7.10pyenv global 2.7.10设置为全局python,但我建议你看一下pyenv virtualenvpyenv virtualenvwrapper项目并为你的代码使用python虚拟环境,或者为你的项目设置python文件夹只能通过cd访问你的项目文件夹并使用pyenv local 2.7.10

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM