@Erotemic
The first thing that comes to mind as you seem to be on some Debian linux or derivative (you mentioned buidl-essential) would be the deadsnakes PPA https://launchpad.net/~deadsnakes to get a binary Python package for a given Python version. This would require sudo though.
The second thing that comes to mind in your case and that could be Linux-distro independent would be AppImage, but that might imply you may need to do the packaging in the first place? there may be some Python appimages to reuse.
https://appimage.org/ and https://appimage.github.io/apps/ ?
Snaps and flatpack are of the same style.
pyenv install python-appimage-3.9
and then get an appropriate folder in ~/.pyenv/versions
? Is there any mechanism to expose the shared library with app-image? IIUC, there would be no way to build or use a c-extension-module with python-appimage that requires loading symbols from the libpython.so, correct?
Hello everyone. I have problem with my python symlink after activating new venv with pyenv.
❯ which python
/usr/bin/python
❯ python -V
Python 3.9.4
❯ which pyenv
/home/vicky/.pyenv/bin/pyenv
❯ pyenv versions
* system (set by /home/vicky/.pyenv/version)
3.8.9
❯ pyenv which python
/usr/bin/python
❯ pyenv global
system
❯ pyenv global 3.8.9
❯ pyenv global
3.8.9
❯ which python
/usr/bin/python
❯ pyenv which python
/home/vicky/.pyenv/versions/3.8.9/bin/python
As you see, I still get my original system python version when I do which python
even after activating 3.8.9
. Can anyone help?
thanks in advance
21.04
and default python version is 3.9.4
python-is-python3
package to get around using python
instead of python3
Downloading http://pypi.doubanio.com/packages/98/83/07b67ec0f26f61894ab65cf1e325c2bd8938f8f4379e989ffadedcbb07e1/pyenv-0.0.1.tar.gz (1.4 kB)
Building wheels for collected packages: pyenv
Building wheel for pyenv (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/ls66635/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/user/1000/pip-install-2bivr697/pyenv/setup.py'"'"'; file='"'"'/tmp/user/1000/pip-install-2bivr697/pyenv/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/user/1000/pip-wheel-cjs6jdk1
cwd: /tmp/user/1000/pip-install-2bivr697/pyenv/
Complete output (12 lines):
running bdist_wheel
running build
installing to build/bdist.linux-x86_64/wheel
running install
We are sorry, but this package is not installable with pip.
Please read the installation instructions at:
https://github.com/pyenv/pyenv#installation
ERROR: Failed building wheel for pyenv
Running setup.py clean for pyenv
Failed to build pyenv
Installing collected packages: pyenv
Running setup.py install for pyenv ... error
ERROR: Command errored out with exit status 1:
command: /home/ls66635/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/user/1000/pip-install-2bivr697/pyenv/setup.py'"'"'; file='"'"'/tmp/user/1000/pip-install-2bivr697/pyenv/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/user/1000/pip-record-bcdv1lof/install-record.txt --single-version-externally-managed --compile --install-headers /home/ls66635/anaconda3/include/python3.7m/pyenv
cwd: /tmp/user/1000/pip-install-2bivr697/pyenv/
Complete output (9 lines):
running install
############################ NOTE ############################
We are sorry, but this package is not installable with pip.
Please read the installation instructions at:
https://github.com/pyenv/pyenv#installation
##############################################################
----------------------------------------
ERROR: Command errored out with exit status 1: /home/ls66635/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/user/1000/pip-install-2bivr697/pyenv/setup.py'"'"'; file='"'"'/tmp/user/1000/pip-install-2bivr697/pyenv/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/user/1000/pip-record-bcdv1lof/install-record.txt --single-version-externally-managed --compile --install-headers /home/ls66635/anaconda3/include/python3.7m/pyenv Check the logs for full command output.
# System-wide profile for interactive zsh(1) login shells.
# Setup user specific overrides for this in ~/.zprofile. See zshbuiltins(1)
# and zshoptions(1) for more details.
if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi
pyenv
to path?
Generally speaking you can put any settings in ~/.zshrc. It is loaded regardless if the shell is interactive, login, or not. ~/.zprofile does not load for non-login shells, but in macOS the default behavior in the terminal is to launch new shells as a login shell
So I have my pyenv init statement in ~/.zshrc and have had it there working for almost 2 years, until I got the warning message after brew updated pyenv to 2.0
eval "$(pyenv init --path)"
eval "$(pyenv init --path)"
does.
OK so far no go, the instructions state: MacOS note: If you installed Pyenv with Homebrew, you don't need to add the PYENV_ROOT= and PATH= lines. You also don't need to add commands into ~/.profile if your shell doesn't use it.
so I created ~/.zprofile and simply put eval "$(pyenv init --path)" inside of it.
I left the following in .zshrc per the instructions:
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
restart the terminal, message is still there.
I'm confused about how modules are being located. I've installed pyenv as a git clone and am able to install python versions, but they seem there seems to be a discrepancy regarding sys.path
.
I've installed a version and selected it: pyenv global 3.9.5
When installing a package with: pip install msgpack
I get the output:
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: msgpack in /usr/lib/python3.9/site-packages (1.0.2)
But when I try to use that package at a python repl:
Python 3.9.5 (default, May 8 2021, 22:00:35)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import msgpack
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'msgpack'
And sys.path
does not show /usr/lib/python3.9/site-packages:
>>> import sys; print(sys.path)
['', '/home/jeremy/.pyenv/versions/3.9.5/lib/python39.zip', '/home/jeremy/.p5/lib/python3.9', '/home/jeremy/.pyenv/versions/3.9.5/lib/python3.9/lib-dynly/.local/lib/python3.9/site-packages', '/home/jeremy/.pyenv/versions/3.9.5/lpackages']
pip install --force-reinstall
as a workaround, but why does the install command above see /usr/lib but not python?
which pip
and pyenv which pip
?
#!/usr/bin/python
.