'Deactivate pyenv in current shell
My .bashrc has this:
enable-pyenv () {
# Load pyenv automatically by adding
# the following to your profile:
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
}
enable-pyenv
Which enables pyenv. In some situations, I want to (temporarily) disable pyenv. How can I do this?
Solution 1:[1]
If you want to use the python version from your system:
pyenv local system
https://github.com/pyenv/pyenv/blob/master/COMMANDS.md#pyenv-global https://github.com/pyenv/pyenv/blob/master/COMMANDS.md#pyenv-local
Solution 2:[2]
To deactivate from current shell environment, trypyenv shell --unset
Solution 3:[3]
I'm not sure that this will get rid of all traces of pyenv, but editing your $PATH environment variable to get rid of the pyenv- or shim-containing paths seems to deactivate pyenv. Eg,
export PATH=`echo $PATH | python -c "import sys, re; print(':'.join(x for x in sys.stdin.read().strip().split(':') if not 'pyenv' in x))"`
If you want to be able to re-enable it, just store your previous $PATH so you can restore it later.
Solution 4:[4]
Try playing around with some variants of:
env -i bash
env -i bash -l
env -i bash --norc
env -i bash --norc --noprofile
This does not come without side effects as env -i nukes your whole session and thus afterwards a lot of convenience like $HOME is gone with the bathwater, but so is pyenv.
Solution 5:[5]
None of the posted answers worked for me but the following did:
$ echo "" > /home/myusername/.pyenv/version
Solution 6:[6]
For me, what worked ultimately was the brute force method of removing all pyenv paths from the $PATH variable:
PATH=`echo $PATH | tr ':' '\n' | sed '/pyenv/d' | tr '\n' ':' | sed -r 's/:$/\n/'`
I wish pyenv offered a better way by itself.
Solution 7:[7]
I use this but not sure if it is a good way
bash
Solution 8:[8]
I have macOS Monterey, v12.0.1. Prophet was successfully installed using python 3.8. It did NOT work with 3.9 versions. I use pyenv to create virtual env. That is what I did:
pip3 install virtualenv
pip3 install virtualenvwrapper
brew install pyenv-virtualenv
You need these commands to have virtual env running under pyenv. Next, install python
pyenv install 3.8.10
Create env called 'prophet':
pyenv virtualenv 3.8.10 prophet
Activate it in your working directory:
pyenv local prophet
Install 2 packages:
pip install pystan==2.19.1.1
pip install prophet
It worked fine for me!
Solution 9:[9]
pyenv shell system
You can use the pyenv shell command to set this environment variable in your current shell session.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | pylanglois |
| Solution 2 | aakinlalu |
| Solution 3 | Noah |
| Solution 4 | Rotonen |
| Solution 5 | user7981958 |
| Solution 6 | shivams |
| Solution 7 | Mohammad Nakhaee |
| Solution 8 | |
| Solution 9 | ??? |
