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 ...
I'm going to be blunt here:
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 ...
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, ...
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.
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 ...
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’...
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".
Do not use update-alternatives to change your default ...
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 ...
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 ...
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.
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.
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 ...
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 ...
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
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 ...
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.
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:
When I ran the command to check the environment variable LANG from my logged-in console, I got the value:
$ echo $LANG
But if I put the same command in my MOTD (bash) script, LANG ...
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 (...
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 ...
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 ...
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:
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
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-...
Answer to revised wording
The only tool that comes to mind (and is widely available) is sed, and it's not exactly pretty.
$ cat file
$ sed ':a;N;$!ba;s/\n/\\n/g;s/\t/\\t/g' file
With acknowledgement to: https://stackoverflow.com/questions/1251999/...
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.