Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyenv over homebrew python #14

Open
AlJohri opened this issue Dec 22, 2015 · 1 comment
Open

pyenv over homebrew python #14

AlJohri opened this issue Dec 22, 2015 · 1 comment

Comments

@AlJohri
Copy link

AlJohri commented Dec 22, 2015

Given that you're using rbenv, I was wondering why you're not using pyenv? I've found it to be invaluable especially working back and forth between python 2 and 3 pretty extensively. After all, we should all be starting new projects in python 3, right?

The source code is well maintained and nearly identical to rbenv. The rbenv HEAD is even merged in periodically.

The installation is entirely identical with the exception that python-build (like ruby-build) is included in the pyenv package :)

brew install pyenv
brew install pyenv-virtualenvwrapper # not necessary, but a nicety
pyenv install -l # list python versions
pyenv install 2.7.10
pyenv install 3.5.0
pyenv global 2.7.10 3.5.0 # sets global python2 and python3

Please let me know if you'd like me to submit a PR!

P.S. Love the repository, I've been trying to maintain a similar repo: https://github.com/AlJohri/dotfiles/blob/gh-pages/Brewfile
You should consider using the brew bundle command instead of brew.sh. (its pretty new, released within the last year).

@donnemartin
Copy link
Owner

I do actually use pyenv regularly :)

I haven't had a chance to update the repo yet. Awhile ago I had started collecting preliminary commands to install pyenv but it probably needs tweaks/polishing.

###############################################################################
# Pyenv                                                                       #
###############################################################################

echo "------------------------------"
echo "Setting up pyenv."

# Check for Homebrew,
# Install if we don't have it
if test ! $(which brew); then
  echo "Installing homebrew..."
  ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi

# Install pyenv
brew update
brew install pyenv

EXTRA_PATH=~/.extra
echo $EXTRA_PATH
echo '' >> $EXTRA_PATH
echo '' >> $EXTRA_PATH
echo '# Pyenv, added by pydata.sh' >> $EXTRA_PATH
echo 'eval "$(pyenv init -)"' >> $EXTRA_PATH
echo 'eval "$(pyenv virtualenv-init -)"' >> $EXTRA_PATH
echo '' >> $EXTRA_PATH
source $EXTRA_PATH

pyenv install 3.3.6
pyenv install 3.4.3
pyenv install 3.5.0
pyenv global 3.4.3

# If you encounter: ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?
# You may need to tell the compiler where the openssl package is located:
# CFLAGS="-I$(brew --prefix openssl)/include" \
# LDFLAGS="-L$(brew --prefix openssl)/lib" \
# pyenv install -v 3.4.3

# Remove outdated versions from the cellar.
brew cleanup

# Restart the shell to enable pyenv-virtualenv
exec "$SHELL"

Please let me know if you'd like me to submit a PR!

Sure, we might need to merge our commands together.

You should consider using the brew bundle command instead of brew.sh. (its pretty new, released within the last year).

Thanks for the tip, I'll check it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants