Question

Can anyone shed any light on how to have pythonbrew / pythonz install when my shell is ZSH. I am on ubuntu 12.04.

I have followed the standard install of curl and then adding the line to ~/.bashrc but it will return an unknown command in a new zsh terminal.

[[ -s $HOME/.pythonbrew/etc/bashrc ]] && source $HOME/.pythonbrew/etc/bashrc

PythonBrew Readme

Was it helpful?

Solution

The bashrc file does not work with zsh unfortunately.

Take python2.5 as an example, this seems to work:

sudo ~/.pythonbrew/bin/pythonbrew install 2.5

Then to invoke python2.5:

~/.pythonbrew/pythons/Python-2.5/bin/python

For convenience set:

$PATH=$HOME/.pythonbrew/pythons/Python-2.5/bin:$PATH

OTHER TIPS

zsh does not read ~/.bashrc - try putting the same code in ~/.zshrc

You can try the emulate command in your zshrc.

emulate sh -c '[[ -s $HOME/.pythonbrew/etc/bashrc ]] && . $HOME/.pythonbrew/etc/bashrc'

I have a different setup (my emulate calls a functionrc that has functions available to bash and zsh), but I think this is going to work.

In case anyone stumbles across this old question:

As I write this (late 2017), pythonbrew is unmaintained and pythonz appears to be in maintenance-only mode.

At this time I would strongly suggest users switch to the actively maintained pyenv instead.

And just for the record, pyenv fully supports bash, zsh and fish.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top