pyenv-virtualenv
pyenv-virtualenv copied to clipboard
` pyenv [ shell | local ] new-env ` is interfered by the previously activated virutalenv.
Hi,
I noticed that when activating some virtualenv with the following command:
$ pyenv [ shell | local ] new-env
The newly activated virtualenv maybe interfered by the previously activated virtualenv, say, named as old-env. To avoiding this problem, the following commands combinations need to be used:
$ pyenv [ shell | local ] --unset
$ pyenv [ shell | local ] new-env
So, it seems the above commands combinations should be defined for activating new virtualenvs.
Regards, HY
Can you please expound a little bit on what you mean by maybe interfered by the previously activated virtualenv ?
More precisely, can you please tell us what led you to pyenv shell --unset
and then pyenv shell new-env
while working on some foo.py
or some other project?
I use pyenv to install anaconda3-2020.02 and then based on the anaconda installed there I created two envs with conda create
located at ~/.pyenv/versions/anaconda3-2020.02/envs/test1
and ~/.pyenv/versions/anaconda3-2020.02/envs/test2
. And then I symlinked both test1 and test2 to the following location: ~/.pyenv/versions/. This way, I can use the symlinked names to manage these envs.
After the above steps, I created some customized scripts under the test1/etc/conda/(de)activate.d which set and unset some alias respectively. At this moment, if I activate test2 whith pyenv shell test2
and then activate test1 with pyenv shell test1
, the command defined by alias for test1 will be set. But when I leave the test1 env, I found that the alias not been unset. Bur if I firstly issue the pyenv shell --unset
command, the problem will be solved.
Regards