I removed Pyenv in MAC. How to initialize environment variable? - pyenv

I have some problems about pyenv in my MAC so I removed it.
After that I open the terminal, always -bash: pyenv: command not found message appear.
I guess this is about environment problem.
How can I solve this?
Last login: Wed Jun 19 22:15:19 on ttys000
-bash: pyenv: command not found
-bash: pyenv: command not found
-bash: pyenv: command not found
-bash: pyenv: command not found
-bash: pyenv: command not found
-bash: pyenv: command not found
-bash: pyenv: command not found
ShinTaeyongui-iMac:~ shintaeyong$

A configuration file of your shell (bash) still contains a reference to the pyenv command. Depending on how you installed pyenv, this configuration file could be ~/.bashrc or ~/.bash_profile (or both).
The lines you are looking for are probably either (if installed via pipenv-installer):
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
Or (if installed via the manual instructions):
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
You should be able to safely remove all lines containing pipenv. If you want to be safe, you can disable the lines instead of removing them by adding an # in front of them.

Related

Unable to activate virtualenv

I am working on a Macbook Pro running MacOS Monterrey, and I'm following instructions to work in a virtual environment from this site. https://duncanleung.com/set-up-python-pyenv-virtualenv-poetry/
While I am able to create a virtualenv, I am unable to activate it.
On running pyenv activate my-env, I get this error message:
Failed to activate virtualenv.
Perhaps pyenv-virtualenv has not been loaded into your shell properly.
Please restart current shell and try again.
My zshrc file has this content:
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv virtualenv-init -)"
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
PATH=$(pyenv root)/shims:$PATH
Result of which python:
/Users/abc/.pyenv/shims/python
Result of python -V: Python 3.9.9
What could be possible reasons for the virtualenv not activating?

command not found: __start_kubectl

I installed kubectl and tried enable shell autocompletion for zsh.
When I'm using kubectl autocompletion works fine. Howewer when I'm trying use autocompletion with alias k then shell return me
k g...(eval):1: command not found: __start_kubectl  8:45
(eval):1: command not found: __start_kubectl
(eval):1: command not found: __start_kubectl
In my .zshrc file I have:
source <(kubectl completion zsh)
alias k=kubectl
compdef __start_kubectl k
add the following to the beginning of your ~/.zshrc file:
autoload -Uz compinit
compinit
then restart your terminal.
Can you try this one:
compdef _kubectl k

How to resolve .zshenv. command not found pyenv?

I have pyenv installed and my .zshenv looks like the following :
export PYENV_ROOT="$HOME"/.pyenv
export PATH="$PYENV_ROOT"/bin:"$PATH"
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
eval "$(pyenv virtualenv-init -)"
When I open a new terminal it gives me the following error:
.zshenv. command not found: : pyenv
The fix in the github issue link didn't work for me.
The problem was that pyenv wasn't on the path at the time of running pyenv init.
I add export PATH=/usr/local/bin:"$PATH" to my .zshenv before calling pyenv init.

Ocamlfind command not found

I'm running into an issue installing a package that's reliant on ocamlfind but I'm getting an ocamlfind: command not found error when making.
I have installed ocamlfind with the ocaml package manager and have tried reinstalling using "opam reinstall ocamlfind".
I have also tried the 'eval opam config env' command to see if updates my bin.
Has anyone run into a similar issue/know what this might be caused by
The output when running the make:
make
ocamlfind ocamlc -pp "camlp4o -I lib/dcg -I lib/ipp pa_dcg.cmo pa_ipp.cmo" -w usy -thread -I lib -I lib/dcg -I lib/ipp -c semantics.ml
/bin/sh: ocamlfind: command not found
The output when trying ocamlfind
ocamlfind
-bash: ocamlfind: command not found
ocaml is installed
opam install ocamlfind
[NOTE] Package ocamlfind is already installed (current version is 1.5.5).
and when running the eval command
eval 'opam config env'
CAML_LD_LIBRARY_PATH="/home/centos/.opam/system/lib/stublibs:/usr/lib64/ocaml/stub libs"; export CAML_LD_LIBRARY_PATH;
MANPATH="/home/centos/.opam/system/man:"; export MANPATH;
PERL5LIB="/home/centos/.opam/system/lib/perl5"; export PERL5LIB;
OCAML_TOPLEVEL_PATH="/home/centos/.opam/system/lib/toplevel"; export OCAML_TOPLEVEL_PATH;
PATH="/home/centos/.opam/system/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/centos/.local/bin:/home/centos/bin"; export PATH;
I'm on a server running centos 7
This command
eval 'opam config env'
is almost assuredly a typo and was supposed to be
eval `opam config env`
though using $(...) instead is the modern equivalent and avoids this font-fact confusion
eval $(opam config env)
That being said that just sets the environment variables in the current shell session (and exports them for use by processes run by this shell session).
As such that needs to be run in every shell session that needs those set (including each line of the makefile that expects them to be set if the environment that runs make doesn't already have them set and exported).
try
sudo apt-get install ocaml-findlib

Why can't I access my vi folder?

I keep getting this error on my terminal which stops me accessing the vi folder. I've been trying to set a path to the MongoDB bin and when experimenting on how to do this, I think I've broken the folder. Can someone please help?
Last login: Mon May 18 10:31:54 on console
-bash: export: `/Users/james.flan/Documents/Software/MongoDB/bin :/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin': not a valid identifier
AMAC02MX3APF8J3:~ james.flan$ cd
AMAC02MX3APF8J3:~ james.flan$ vi .bash_profile
-bash: vi: No such file or directory
AMAC02MX3APF8J3:~ james.flan$
Expanded:
AMAC02MX3APF8J3:~ james.flan$ cat ~/.bash_profile
-bash: cat: No such file or directory
AMAC02MX3APF8J3:~ james.flan$
AMAC02MX3APF8J3:~ james.flan$ /bin/cat ~/.bash_profile
export PATH= "/Users/james.flan/Documents/Software/MongoDB/bin :$PATH"
AMAC02MX3APF8J3:~ james.flan$
The problem is with your $PATH variable. You have broken it, so bash does not find any utility out of your current working directory.
To fix your issue you can execute vi directly with the absolute path:
$ /usr/bin/vi ~/.bash_profile
Then edit your $PATH declaration line:
export PATH="/Users/james.flan/Documents/Software/MongoDB/bin:$PATH"
Then you can either start a new Terminal session, or in the same session do:
$ /bin/bash -l