brew install pyenv- Open
~/.bashrc(or.bash_profile, on Linux) and add the following between the stuff for Rbenv and Git:
# Pyenv
export PYENV_ROOT=/usr/local/var/pyenv
eval "$(pyenv init -)"pyenv install 3.5.1(or other version)pyenv global 3.5.1(this can be combined with the previous command aspyenv install 3.5.1 && global 3.5.1)- Python doesn't ship with the most up to date version of package manager
pip, so upgrade pip :pip install -U pip - Install pyenv-virtualenv, a tool that creates a named directory of executable dependencies and makes that directory available at the global level. Think of it this way:
- With Ruby and Bundler,
bundle installinstall all gems listed in the Gemfile into a global bucket (technically, subdivided by version of Ruby) which is then accessible to all projects; runningbundle execensures that you execute the right versions of those dependencies for any given project. - With Node and NPM,
npm installinstalls all Node moules listed inpackage.jsoninto a localnode_modulesdirectory; since there's a separatenode_modulesfolder inside each project, all executables are implicitly project-specific. However, this has the downside of downloading lots of copies of the same Node modules. - With
pyeyv-virtualenv, you have a single global directory (bounded by Python version), just like Ruby; however, inside that global directory, you can create custom bundles of dependencies (i.e. 'virtual environments') and load a single bundle of dependencies inside multiple different projects. Kind of like lots of littlenode_modulesdirectories, but with different names, and capable of being referenced by name and manually loaded.
When you start a new python project, load up the appropriate requirements file (e.g. requirements-test.txt) by running
pip install -r requirements-test.txt
To actually run your mamba tests, go to the root of your project repo and run mamba; it will look for a specs directory.
I prefer to use my home directory for environment switching tools (NVM_DIR=
/.nvm, RBENV_ROOT=/.rbenv, and now PYENV_ROOT=~/.pyenv). This makes it more platform independent (/usr/localis usually owned by root on a linux box). Your mileage may vary.