pipusing the system python, I get
home/crater2150/.local/share/pyenv/pyenv.d/exec/pip-rehash/pip: /home/crater2150/.local/bin/pip: /usr/bin/python2: bad interpreter: No such file or directory. Curiously, calling the
pythonshim works and starts my system python, and so do various other system commands that have a shim, only
/usr/bin/pythonis a symlink to
python3, there isn't any reference to python2 left in my
/usr/bin/pip, it just isn't recognized via the shim (or rather, executed with the wrong, nonexistent python)
~/.local/binwas the problem, I'm not sure, how that ended up there, probably the system pip2 installed it.
hey all. I've got some beef between pyenv and ansible. I understand where the problem is coming from, but I'm unsure how to fix it. Looking for some ideas. Some details:
ansible is being installed from my system package manager (im on pop os 20.04, based off ubuntu 20.04) to /usr/bin. pyenv is installed to ~ using the github checkout method.
Now, when I run
eval "$(pyenv init -)"
pyenv modifies my
PATH to use the shim'd python executable before system python. this is what is is supposed to do. but now when i execute ansible, I get this error:
ModuleNotFoundError: No module named 'ansible' - which is totally understandable as
ansible isn't installed to
pyenv's python environment.
my question is...how should I manage this? is there a way to 'force' ansible to use the system python install? is there a way to set
pyenv init - to append
PATH instead of prepending it? this allows the shebang in the
ansible system install script to work properly...but i suppose this is nonideal because it exposes system python in some way. should I just suck it up and setup an ansible virtualenv/pyenv environment and just use that?
is there a simple solution to all of this that I'm not seeing?
eval "$(pyenv init -)"from my startup scripts altogether. and only call it when im working on a python project. then use system python most of the time. certainly a bit annoying but an option.
to expand on the above @pombredanne - if create a system python link like so
sudo ln -s /usr/bin/python3 /usr/bin/python
Now i get this
❯ pyenv shell system ❯ which python /home/kent/.pyenv/shims/python ❯ pyenv which python /usr/bin/python
Is that unexpected behaviour?
Now whether or not it is smart or safe to manually make that link in /usr/bin is a whole other issue....
Unsure what is the indicator here that pyenv is buggered up
pyenv install --debug 3.9-dev. But when I run
sudo gdb /path/to/.pyenv/versions/3.9-dev-debug/bin/python3.9dI get
Reading symbols from /path/to/.pyenv/versions/3.9-dev-debug/bin/python3.9d... warning: `/private/var/folders/00/l36df9q14hv13hhw8wglncch0000gr/T/python-build.20201201132008.47447/Python-3.9-dev/Programs/python.o': can't open to read symbols: No such file or directory. warning: Could not open OSO archive file "/private/var/folders/00/l36df9q14hv13hhw8wglncch0000gr/T/python-build.20201201132008.47447/Python-3.9-dev/libpython3.9d.a" (No debugging symbols found in /path/to/.pyenv/versions/3.9-dev-debug/bin/python3.9d)