Hot answers tagged

8

Simple solution is edit .bashrc and put this line: alias python3=python3.7 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/...


7

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 Done.


7

Create symlink for /usr/bin/python3. In my LinuxMint: # ls -lh /usr/bin/python3 /usr/bin/python lrwxrwxrwx 1 root root 9 ноя 24 2017 /usr/bin/python -> python2.7 lrwxrwxrwx 1 root root 9 сен 6 2017 /usr/bin/python3 -> python3.5 # mv /usr/bin/python # cp /usr/bin/python3 /usr/bin/python # python --version Python 3.5.2


6

using these commands can help you: check the version of python: ls /usr/bin/python* alias: alias python='/usr/bin/pythonxx' re-login: . ~/.bashrc check the python version again: python --version


3

Summarised from another site: Core package repositories for CentOS 7 does not have python-pip. For that you need to enable an EPEL ("Extra Packages for Enterprise Linux") repository. You do that with sudo yum install epel-release After that, you should be able to install pip with sudo yum install python-pip Also possibly related: How to install pip ...


2

In my experience, if you install Anaconda as the user (not to the system with sudo), it will install all its files, including its python version, to your specified directory in your Home. Only Anaconda support files are put into your system folders, so there is no interference with the operation of existing programs. In order to use the Anaconda programs ...


2

Maybe Virtual Studio Code does not use the same shell that you're using with iTerm2? According to the docs on the integrated terminal, the shell that is being used is the one which is set by the $SHELL environment variable. Inspect it with: echo $SHELL Furthermore, which scans your $PATH for an executable and return the first one found. So compare your ...


2

as suggested in the comments: don't use sudo pip install as you will get conflicts with the system package manager sooner or later. Always install python packages via pip install --user. $HOME/.local/lib/python3.6/site-packages shouldn't be on PATH, it's the directory containing python modules (python source code files), but no executables. You can check the ...


2

This line in the systemd unit file is still wrong: ExecStart=/usr/bin/env/python3 /home/sangharsh/code/workingWithFiles/test.py I am pretty sure there is no /usr/bin/env/python3 on your system. It's the same problem as in muru's first comment.


2

The error is because of Python 3.6 code: os.execvp("/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", ("",) + tuple(sys.argv[1:])) You need to change "" to " ", because it treats "" as empty. For more info you should visit this link. Here you will find the files which need the above modification (to replace "" with " ").


2

To make long story short, Python's os.stat() outputs size in bytes. However, your file manager shows size in Kibibytes, which is a measure in powers of 2 instead of 10 as Kilobytes do (and because computer science for the most part uses powers of 2, while average consumers are more familiar with powers of 10). To be more specific, Python's os.stat() shows ...


1

change BlockingScheduler with BackgroundScheduler as it needs to run in background. BlockingScheduler needs active terminal which is not available in systemd.


1

You need to remove the packages which were installed along with python3.6: sudo apt autoremove This will remove the packages which apt-get told you about when you removed python3.6: The following packages were automatically installed and are no longer required: libpython3.6-minimal libpython3.6-stdlib python3.6-minimal Use 'sudo apt autoremove' to ...


1

Using string.split() you can achieve this. You need to use [ and ] to split a string into two parts. Then get the part of the string you want. To remove whitespaces you can use string.strip() import sys input_file=sys.argv[1] with open(input_file) as fp: lines=fp.readlines() for line in lines: if "Soft reset timeout" in line: #...


1

Thanks to @Bart I have managed to solve all the error codes. This is how I did it. The install errors error: invalid command 'bdist_wheel', Failed building wheel for py-postgresql and Failed to build qubit py-postgresql were all solved by installing wheel, according to this post. In short I just ran python3.7 -m pip install wheel python3.7 -m pip install --...


1

you may need to install/reinstall wheel pip package, or see this thread: https://stackoverflow.com/questions/34819221/why-is-python-setup-py-saying-invalid-command-bdist-wheel-on-travis-ci


1

Python 2 and Python 3 can be installed on the same system without conflict. You can install the Python 3 version of pip similar to how you installed the Python 2 version: sudo apt install python3-pip Now, you you should be able to use pip3 to install spotdl: pip3 install spotdl I just tried this on my own system and the installation failed when running ...


1

As Stephen Kitt points out, what you have is a shared library (equivalent to Windows .dll). It is generally accepted that Cython is intended to create C modules for Python rather than whole programs (equivalent to Windows .exe). You will therefore find some resistance on the internet to the idea that Cython can be used in this way. However you should ...


1

.so files are dynamic libraries, they do not run on their own, but get loaded from other programs. You can either load them from your local folder, or put it into a folder listed in your PATH variable and load it from another program in a different directory.


1

One reliable way is to do: ssh 127.0.0.1 sh << "EOF" echo "trap '/tmp/test &' INT" >> /tmp/output.txt EOF Then you know what shell you get, here sh as opposed to the login shell of the remote user whichever it is, and you can easily pass the code for that sh to interpret verbatim without having to worry about quoting. (BTW, you harldy want ...


1

Since you’re using Debian, and the modules you’re interested in are available as packages, we can use those to solve your problem. In circumstances such as these, where using part of a module requires another module which isn’t part of the first’s strict dependencies, there’s probably an optional dependency which would fix your problem; the package for ...


1

Read the wiki at the pyenv project's repo on GitHub. Common build problems from pyenv wiki Make sure to follow this guidance for your platform before any troubleshooting. Ubuntu/Debian: sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \ libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ ...


1

From https://bugs.python.org/issue31652#msg321260 sudo apt-get install build-essential libsqlite3-dev sqlite3 bzip2 libbz2-dev zlib1g-dev libssl-dev openssl libgdbm-dev libgdbm-compat-dev liblzma-dev libreadline-dev libncursesw5-dev libffi-dev uuid-dev


1

You can fix your Python installation without fixing lsb_release. Your Python installation needs other Python packages to be reinstalled; at least sudo apt install --reinstall libpython3.6-minimal and perhaps more. To reinstall all the packages, run sudo apt install --reinstall libpython3.6{,-minimal,-stdlib} python3.6{,-minimal} You should then find that ...


1

It looks like you want to use python from non-standard location. Set PYTHONPATH and PYTHONHOME variables to let it know that: export PYTHONPATH=/anaconda3/bin/python export PYTHONHOME=/anaconda3/


1

TLDR ~ You're probably safe but... There is a danger. This is why the default python on the command line is still python 2 for many distributions. Will this actually hurt you? That's impossible to know without knowing which linux distribution you have which packages. I doubt anyone has full oversight of every package available in the world to know what ...


1

It's worth noting that to add the PPA's, you will need the software-properties-common package installed. Without this, you'll get: bash: add-apt-repository: command not found Or something similar. To fix this, simply run: sudo apt-get install software-properties-common And it'll install the add-apt-repository command for you!


1

if you have multiple version of python in your system. You just need to update the symbolic link of python inside /usr/bin/ root@irshad:/usr/bin# ls -lrth python* lrwxrwxrwx 1 root root 9 Apr 16 2018 python -> python2.7 -rwxr-xr-x 1 root root 3.6M Nov 12 2018 python2.7 -rwxr-xr-x 2 root root 4.4M May 7 14:58 python3.6 In above example if you see ...


1

update-alternatives is to change system symlinks to user-defined/admin-defined symlinks. If you have multiple versions of python3 installed in your system and want to control which python3 version to invoke when python3 is called. Do the following sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.4 1 sudo update-alternatives --...


1

I have found another possible solution. I found this by digging through someone's git hub repo. This uses python3 built in socket module. Prerequisites: You have a working adapter at address <adapter address>. You have your target Bluetooth device at <device address>. The device is pinned. That is, the same point that rfcomm can be used. $python3 ...


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