Ubuntu 16.10+ and Python 3.7 dev
sudo apt-get install zlib1g-dev
note: i only put this here because it was the top search result for the error, but this resolved my issue.
update: also the case for ubuntu 14.04LTS and base kernel at 4.1+
From the comment:
sudo update-alternatives --config python
Will show you an error:
update-alternatives: error: no alternatives for python3
You need to update your update-alternatives , then you will be able to set your default python version.
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.4 1
sudo update-alternatives --...
Shell loops are slow and bash's are the slowest.
Shells aren't meant to do heavy work in loops. Shells are meant to launch a few external, optimized processes on batches of data.
Anyway, I was curious how shell loops compare so I made a little benchmark:
for sh in dash bash ksh zsh; do
TIMEFORMAT="%RR %UU %...
I did a bit of testing, and on my system ran the following--none made the order of magnitude speedup that would be needed to be competitive, but you can make it faster:
Test 1: 18.233s
while [[ $i -le 4000000 ]]
while [[ $i -le 4000000 ]]
This is a known bug in bash; see the man page and search for "BUGS":
It's too big and too slow.
For an excellent primer on the conceptual differences between shell scripting and other programming languages, I highly recommend reading:
Why is using a shell loop to process text considered bad practice?
The most pertinent excerpts:
A shell is efficient if you use it for what it has been designed for (though efficiency is rarely what you look for in a shell).
A shell is a command-line interpreter, it is designed to run commands and have them cooperate to a task.
If you want to count to 1000000000, you invoke a (one) command to count, like seq, bc, awk or python/perl... Running ...
The issue is that simply executing has('python') in an if-statement causes python3 to be unavailable when vim was compiled with both python/dyn and python3/dyn. The simplest solution is probably just to add something like
if exists('py2') && has('python')
to your .vimrc before Vundle loads anything. Then, if you ever ...
python36u is an alternative build provided by IUS; python36 is an EPEL package.
yum info python36 python36u will show you different repos for the two, and it's likely that the IUS one has a slightly higher minor version number than the EPEL package. And just to make things even more confusing, there's also Redhat Software Collections, which provide rh-...
Simple solution is edit .bashrc and put this line:
Whenever you will write python3 it will replace it with python3.7.
Or you can use command update-alternatives which is preferred i.e:
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/...
This doesn't work because source is a shell command, so systemd's ExecStart= or ExecStartPre= won't understand them directly... (BTW, the same is true for cd and the &&.)
You could achieve that by running a shell explicitly and running all your commands together there:
ExecStart=/bin/sh -c 'cd /home/debian/ap/ && source venv-ap/bin/activate ...
Unix systems don't really have a “system language”. Unix is a multiuser system and each user is free to pick their preferred language. The closest thing to a system language is the default language that users get if they don't configure their account. The location of that setting varies from distribution to distribution; it's picked up at some point during ...
Ubuntu 14.04 has the lsb_release.py file installed for Python 2.7 as well and lsb_release seems to work under python2.7 as well. You can try this by doing:
If that works, make a backup of the file /usr/bin/lsb_release and change the first line to read:
(you can experiment with the -Es options, I would ...
You do not need to uninstall Python 2 in order to install Python 3. apt-get install python3 will install it in parallel. Also, in Ubuntu, the minimal subset of Python provided by python-minimal is an essential package, so uninstalling it could have catastrophic consequences.
I just had to do this, I find whenever I build python from source I have many issues (the 2 most annoying are not having a history when pressing the up key and getting an _sqlite module not available! Both can be fixed but it's just annoying having to fix them).
So to answer your question, the best way is to add Felix Krull's deadsnakes PPA at;
Apparently the issue was related to the opencv-python library. I tried to open a python session and import that module mannually but it produced the same error. I removed that module from pip and installed it again with apt install python3-opencv. It worked.
Your system may not be looking in /usr/local/lib by default for shared libraries. When you compile things, set the environment variable:
This is only needed when you compile things.
That or add /usr/local/lib to the directories searched by the system for shared libraries.
It's very likely that the python command has been hashed and that you need to clear the cache. In order to see what executable is actually being run you can use the type command, e.g.:
type -a python
Unlike the which command, the type command is aware of hashed programs, as well as aliases and shell functions.
For further discussion of which (no pun ...
You can achieve this by applying below simple steps -
Check python version on terminal - python --version
Get root user privileges. On terminal type - sudo su
Write down the root user password
Execute this command to switch to python 3.6 -
update-alternatives --install /usr/bin/python python /usr/bin/python3 1
Check python version - python --version
By default only Python 2.7 is shipped with CentOS 7, so using pip instead of pip3 only builds from Python 2.7.
You'll want to enable EPEL repository, then install Python 3.4 and then get pip3.
sudo yum install epel-release
sudo yum install python34 python 34-setuptools
sudo easy_install-3.4 pip
then go back and run
pip3 install python-openstackclient
As is typical with some of the modules in ansible you have to install certain Python modules on the remote server's side.
You can use the pip module to facilitate this through your ansible playbook like so:
- name install pexpect
Your distro may have these available as ...
I found this post which mentioned to configure which ATLAS (linear algebra package) version to use:
$ sudo update-alternatives --set libblas.so.3 /usr/lib/atlas-base/atlas/libblas.so.3
$ sudo update-alternatives --set liblapack.so.3 /usr/lib/atlas-base/atlas/liblapack.so.3
After that, I was happily surprised that in fact there was no longer a permissions ...