Questions tagged [python3]
380 questions
346
votes
10 answers
Change the Python3 default version in Ubuntu
I am using Ubuntu 16.04 LTS . I have python3 installed. There are two versions installed, python 3.4.3 and python 3.6 . Whenever I use python3 command, it takes python 3.4.3 by default. I want to use python 3.6 with python3.
python3 --version shows…
codeclue
- 3,573
- 3
- 9
- 6
109
votes
6 answers
zipimport.ZipImportError: can't decompress data; zlib not available
On RHEL 6.6, I installed Python 3.5.1 from source. I am trying to install pip3 via get-pip.py, but I get
Traceback (most recent call last):
File "get-pip.py", line 19177, in
main()
File "get-pip.py", line 194, in main
…
Flair
- 1,191
- 2
- 7
- 6
33
votes
8 answers
Is there something wrong with my script or is Bash much slower than Python?
I was testing the speed of Bash and Python by running a loop 1 billion times.
$ cat python.py
#!/bin/python
# python v3.5
i=0;
while i<=1000000000:
i=i+1;
Bash code:
$ cat bash2.sh
#!/bin/bash
# bash v4.3
i=0
while [[ $i -le 1000000000…
Alex Jones
- 6,223
- 17
- 51
- 83
32
votes
2 answers
How to run a command inside a virtualenv using systemd
I believe this should be simple but I can't get it to work properly.
These are the commands I can run on command line:
cd /home/debian/ap
# Start a virtualenv
source venv-ap/bin/activate
# This needs to happen inside the virtualenv and takes ~20…
sscirrus
- 475
- 1
- 6
- 10
29
votes
4 answers
How to make python3.7 default
I have installed python3.7 however I am not sure how to make it the default python.
See below:
~/Documents/robosuite$ python3.7
Python 3.7.1 (default, Oct 22 2018, 11:21:55)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for…
piccolo
- 393
- 1
- 3
- 5
22
votes
4 answers
gcc error installing psycopg2 package for python3 on Centos 7.3
As per this answer, I performed a series of prerequisite setups to be ready to pip install python3 packages.
However, when I ran
python3 -m pip install psycopg2
I got the following error:
Downloading/unpacking psycopg2
Downloading…
amphibient
- 12,222
- 18
- 62
- 87
17
votes
4 answers
cron job to run under conda virtual environment
I have a Anaconda Python Virtual Environment set up and if I run my project while that virutal environment is activated everything runs great.
But I have a cronjob configured to run it every hour. I piped the output to a log because it wasn't…
MetaStack
- 371
- 1
- 3
- 10
15
votes
1 answer
Difference between installing a package with 'apt' and 'pip'
I have been trying to install a Python module which relies in setuptools, and apparently the module was installed using apt. However, it seems to be the wrong version, so I tried to install it using pip just to see if anything changes (spoiler:…
bert
- 255
- 8
15
votes
1 answer
"ModuleNotFoundError: No module named 'apt_pkg'" appears in various commands
I get the following error in various situations, for example when I try to start a package that is not installed:
$ tldr
Traceback (most recent call last):
File "/usr/lib/command-not-found", line 28, in
from…
Gal
- 521
- 1
- 4
- 8
12
votes
5 answers
Change location of `~/.python_history`
I want to keep the functionality, but change the location of ~/.python_history to $XDG_DATA_HOME/python/python_history.
This gave me the following idea:
I could create $XDG_CONFIG_HOME/python/pythonrc and point $PYTHONSTARTUP to it.
In there I want…
maddingl
- 554
- 1
- 6
- 20
10
votes
1 answer
CentOS python3 package difference between python36 and python36u
I'm seeing 2 packages for Python 3 with the same name, when using search:
$ yum search python36
And I'm not sure what's the difference between them? Why have 2?
python36.x86_64 : Interpreter of the Python programming language
and
python36u.x86_64…
Bohdan
- 145
- 1
- 6
10
votes
3 answers
Alternative to the now deprecated rfcomm binary in bluez
Since bluez 5.44, the rfcomm binaries contained in bluez-utils (amongst others like hcitool) are considered deprecated and are from now on only included in the bluez-utils-compat package provided by the AUR.
Is there a similar command-line…
eike
- 478
- 4
- 15
9
votes
2 answers
How to make `python` an alias of `python3` systemwide on Debian
The latest updates of my Debian testing system removed Python version 2, and I only have Python 3 installed, with python3. There is no longer any command named python. This causes several scripts to fail, including scripts compatible with Python…
a3nm
- 8,978
- 5
- 28
- 36
8
votes
2 answers
How to downgrade python version in Ubuntu 20.04?
I need to change my python version from 3.8 to 3.6 ?
How can I achieve this in Ubuntu 20.04. I tried pyenv, but when I try to use pyenv like pyenv global 3.6.0 then I do python3 and I have still 3.8 verision.
Brokolicový Džuß
- 205
- 1
- 2
- 6
8
votes
3 answers
How to change python default version from 2.7 to 3.7 on RHEL 7
How to change python default version from 2.7 to 3.7 on RHEL 7.
Installed python on RHEL7 virtual machine by following this https://tecadmin.net/install-python-3-7-on-centos/
When I check python version it still prints old version.
itgeek
- 229
- 1
- 6
- 11