Hot answers tagged

16

For Ubuntu use sudo apt install libpq-dev


6

Posted a working solution (on Ubuntu 18.04) with detailed reasoning on SO. The short form is: 1. Copy snippet appended by Anaconda in ~/.bashrc (at the end of the file) to a separate file ~/.bashrc_conda As of Anaconda 2020.02 installation, the snippet reads as follows: # >>> conda initialize >>> # !! Contents within this block are ...


5

I'm going to be blunt here: Don't. The reason python 2.7 is still installed on your system is almost certainly because various scripts and programs, possibly system-essential ones, still rely on 2.7 and haven't been ported to 3.x yet. Python 2.7 programs do not work in Python3 without extreme rewriting. Your package manager will almost certainly refuse ...


4

CentOS 7 requires Python 2.7 and it will continue to be supported with security patches from RedHat, RedHat will be supporting Python2 through part of the lifecycle of RedHat/CentOS 8 until CentOS 7 goes End of Life in 2024. CentOS 7 does support installing newer versions of Python alongside the default version (look into the CentOS Software Collections, ...


3

at first, it looks like a socket issue but socket.gethostbyname(host_name) works. after some digging, I find that the issue is isolated to " mysql-connector-python" if you change that to " mysql-connector-python-rf" in your tox.ini the error is gone. that means somewhere in mysql-connector-python it is unable to resolve dns to ip.


3

This is apt being overly helpful: if apt install fails to match the specified package, and the package contains ., ?, or *, then it is interpreted as a regular expression, and any matching package is selected for installation. In your case, python3.6 doesn’t exist, so apt proceeds to try to install a huge amount of related packages. There’s no general way ...


3

If you want to stick to the rule that everything in /usr apart from /usr/local should come from a package, I would actually download the python-is-python3 package and install that. It only ships the /usr/bin/python symlink and required documentation, and its package relations are unlikely to cause problems in the future. An alias won’t help with your scripts’...


2

I would like to expand on a previous answer as the two approaches given are not equivalent, and one of them can even break the system. The issue is there are two different things one could be trying to do by "changing the default python version". Quick summary Add alias python3=python3.7 to .bashrc. Do not use update-alternatives to change your default ...


2

Anybody else here who tried or wants to try the same thing, don't remove Python3 this way on Ubuntu ! It might remove your whole ubuntu-desktop. In case you run into problems: sudo apt-get install python3-all sudo apt-get install gnome-terminal sudo apt-get install ubuntu-desktop In case you are unable to open the terminal, press Ctrl+Alt+F1 to get a shell ...


2

This is a solution that has worked well for me. source /root/miniconda3/etc/profile.d/conda.sh && \ conda activate <your_env> && \ python <your_application> & I am using miniconda with Conda version 4.7.12 on a Ubuntu 18.04.3 LTS. I am able to place the above inside a script and run it via crontab as well without any ...


2

Assuming python's own pip package manager is installed and configured correctly, you may try pip install python-geoip-python3 pip install python-whois to install the missing packages. Depending on the installation, the binary may also be called pip3.


2

There's no reason to keep the sources because you can always download them again.


2

BTW, python is not an ordinary package in Gentoo. (mostly because portage itself depends on python.) => Other variables are important to be set too. And need to be coherent. The idea behind USE flags is that it is reserved for setting user preferences. Preferences that can, at worse, make one package non functional but in no case, break the entire system. ...


1

The directory that the Python 3.7 executable is installed in, /usr/local/bin, is not located in your PATH. You can see your PATH in the error returned from running which python3, which printed /sbin:/bin:/usr/sbin:/usr/bin as the PATH. You can also view what your path is by printing the contents of the variable to the terminal, e.g. echo $PATH. You can ...


1

Just change it back. Python 2 and 3 are not compatible. By making that change, you have set your default python to be python3 and the system expects python to run a python 2 version. The file you have at /usr/bin/terminator is a python2 script and you can't run it with python3. So just run the exact same command and change it back. If you can't open a ...


1

Original answer from https://askubuntu.com/q/1242009/747557, credit to @Hmdbbgh. The solution that worked for me was to reinstall python3-apt: sudo apt remove python3-apt sudo apt autoremove sudo apt autoclean sudo apt install python3-apt


1

When you use subprocess.run with shell=True, Python starts a shell process that in turn starts your process. This means that it executes sh -c "pkill -9 -f 'java.*7104'". The pkill process only has special protections to avoid matching itself, not to avoid matching its parent process. You need to adjust your regex to not match itself. Putting a ^ before java ...


1

My thoughts is that Kali is based but is not using the Debian repositories itself, the package exist at https://packages.debian.org/sid/amd64/python3-whois. So as last chance you can download it manually and install it but a log of apt update is the fest way to check if is using those repositories.


1

I unknowingly upgraded system version of python which caused this error. So while upgarding python never use make install but use make altinstall. So problem was solved after reinstalling the OS.


1

It turned out to be an encoding issue as I suspected. I found a similar question to encoding in the MOTD with the answer I needed here: https://serverfault.com/a/207357 When I ran the command to check the environment variable LANG from my logged-in console, I got the value: $ echo $LANG C.UTF-8 But if I put the same command in my MOTD (bash) script, LANG ...


1

I would recommend using a virtual machine (for Mint you could use Virtualbox, or you might have Gnome boxes) as once you get it set up you administer the box as normal. You would want to install the following on the box: Cygwin so you can have a familiar bash environment Python so you can test the python source without compiling on the Windows box as well (...


1

There doesn't seem to be some automated way to achieve this fully. However, here's the best I managed to do: As @Mark suggests: 1.1 Start a Python REPL (i.e. run python3 at the command line) 1.2 paste all of those import commands 1.3 check which modules Python lists as missing; everything else is already covered, either by the "standard library" or by ...


1

Unbelievable, I spent a week with my kind TA trying to solve this issue with no luck. I just got it to work. Here is what I did (hopefully it will work for you too): Open up Wing IDE. Go to Edit -> Configure Python... Ensure that Python Path, Environment, and Initial Directory are untouched. Change Python Executable at the top to Custom. Click the Browse ...


1

I know this might be a bit too late to answer but I would like to redirect you to the following page which contains all the steps you need to take in order to deploy your Flask application over the internet, but before that make sure that apache2 is correctly installed on the machine: https://www.digitalocean.com/community/tutorials/how-to-deploy-a-flask-...


1

You need to install PyGObject with python -m pip install PyGObject. Brace yourself, problem related to cairo library missng are coming!


1

I've tried to reproduce your error and in fact I succeeded in doing that. I have a Debian system, so I used apt to install all the packages I wanted to install. I tried to run in an interactive python environment (sorry for the bad terminology, I'm not proficient in python: I used it only a few times to solve very simple math problems) the code from PyQt4....


1

According to this change log notice for the latest revision of their Python 3.8 release, the maintainers of the Deadsnakes PPA acknowledged that their release conflicts with upstream Ubuntu. First update python3.8 to the newest release or remove it entirely. You want to ensure the removal of the python3.8-distutils, python3.8-tk, python3.8-gdbm, python3.8-...


1

Answer to revised wording The only tool that comes to mind (and is widely available) is sed, and it's not exactly pretty. sed ':a;N;$!ba;s/\n/\\n/g;s/\t/\\t/g' So... $ cat file line0'field0 line1 field1" $ sed ':a;N;$!ba;s/\n/\\n/g;s/\t/\\t/g' file line0'field0\nline1\tfield1" With acknowledgement to: https://stackoverflow.com/questions/1251999/...


1

The python3-pkg-resources is removed from jessie-backports. sudo apt purge python3-pkg-resources It will be installed from the main repository as dependencies. sudo apt install python3-pip


1

The Software Architecture Group (SWAG) has created bash2py. According to https://www.swag.uwaterloo.ca/bash2py/index.html: Bash2py is a Bash to Python script translator [...] Install that and put your bash script through it. Haven't tried it, so I'm not really sure about the quality of the outputted script.


Only top voted, non community-wiki answers of a minimum length are eligible