'I think I have a problem with pyenv on my server
I have used pyenv to create some virtualenv for my project, and a few month ago, it seems to make some confusing problem.
Everytime when I go into the directory which I had set venv, it looks work, but it won't work currectly
root@VM-4-7-debian:~# cd /www/wwwroot/FFXIVBOT
(venv-ffxivbot) root@VM-4-7-debian:/www/wwwroot/FFXIVBOT# pyenv versions
system
3.8.9
3.8.9/envs/venv-ffxivbot
3.8.9/envs/venv-maibot
3.8.9/envs/venv-telegram
3.8.9/envs/venv-temp
3.9.12
* venv-ffxivbot (set by /www/wwwroot/FFXIVBOT/.python-version)
venv-maibot
venv-telegram
venv-temp
(venv-ffxivbot) root@VM-4-7-debian:/www/wwwroot/FFXIVBOT# python --version
Python 2.7.16
(venv-ffxivbot) root@VM-4-7-debian:/www/wwwroot/FFXIVBOT# ~/.pyenv/versions/venv-ffxivbot/bin/python --version
Python 3.8.9
(venv-ffxivbot) root@VM-4-7-debian:/www/wwwroot/FFXIVBOT#
here is the settings in my .bashrc:
export NVM_DIR="/www/server/nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
export PATH="~/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
export PATH="$PATH:/usr/local/go/bin:~/go/bin"
export HISTTIMEFORMAT="%d/%m/%y %T "
export PROMPT_COMMAND="history -a; $PROMPT_COMMAND"alias php='php -c /www/server/php/74/etc/php-cli.ini'
alias php74='php74 -c /www/server/php/74/etc/php-cli.ini'
I really don't know why it will happen.
my PATH:
root@VM-4-7-debian:~# echo $PATH
/root/.pyenv/plugins/pyenv-virtualenv/shims:~/.pyenv/bin:/www/server/nvm/versions/node/v14.16.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-11-oracle/bin:/usr/lib/jvm/java-11-oracle/db/bin:/usr/local/go/bin:~/go/bin
root@VM-4-7-debian:~#
Solution 1:[1]
I have just repair it when I try to replace
eval "$(pyenv init -)"
into
eval "$(pyenv init --path)"
in my .bashrc.
I think it because pyenv had change the command which will be wrote in .bashrc.
pyenv has said these two different settings to be wrote into .bashrc on his README and now eval "$(pyenv init -)" might be the wrong one.
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 | Windmourn |
