1

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

sayth
  • 6,696
  • 12
  • 58
  • 100

4 Answers4

2

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
Xuan
  • 5,255
  • 1
  • 34
  • 30
0

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

Dan Stowell
  • 4,618
  • 2
  • 20
  • 30
  • adding that to ~.zshrc still results in zsh not seeing pythonbrew. sayth@sayth-TravelMate-5740G[~] [9:04]:pythonbrew list zsh: correct 'pythonbrew' to '.pythonbrew' [nyae]? n zsh: command not found: pythonbrew – sayth Aug 17 '12 at 23:06
  • Also tried altering the initial command to curl -kL http://xrl.us/pythonbrewinstall | zsh but also no go. – sayth Aug 17 '12 at 23:08
0

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.

GmonC
  • 10,924
  • 1
  • 30
  • 38
0

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.

wjv
  • 2,288
  • 1
  • 18
  • 21