Hot answers tagged

307 votes
Accepted

Why are tar.xz files 15x smaller when using Python's tar library compared to macOS tar?

Short answer: yes, it is safe to use Python tarlib to compress the data, nothing is lost compared to BSD tar. Underlying issue: sorting I think the underlying issue is that BSD tar and GNU tar without ...
304 votes

Typing “python” on Windows 10 (version 1903) command prompt opens Microsoft store

Fixed it by removing it automatically on the settings page. Under Apps and Features, there are an application execution aliases. I am running the latest 1903 update.
  • 3,141
133 votes
Accepted

macOS, the command line developer tool missing after updated to Monterey 12.6

I ran into the same error yesterday, it took a while to notice that the error itself has the solution :) Please ensure Xcode packages are up-to-date — try running 'xcodebuild -runFirstLaunch'. Indeed,...
97 votes
Accepted

Can't install virtual interpreter in PyCharm in Linux

I had to install it. This was fresh Kubuntu 18.04 install, obviously, without this needed package. sudo apt-get install python3-distutils After that I restarted PyCharm and creating virtual project ...
  • 1,949
71 votes

Docker / GCloud | How to fix docker-credential-gcloud not installed or not available in PATH?

I had the same exact issue. Deleting ~/.docker/config.json fixed it for me right away. See here: https://github.com/docker/for-linux/issues/383.
68 votes
Accepted

Accidentally deleted log file of running process `python something.py 2>&1 | tee .log`. Is there a way to still save the output on the tmux-pane?

The file continues to exist as long as the tee process holds an open file descriptor, and everything is still being logged there. You can recover its current contents by copying them through /proc: ...
  • 401k
48 votes
Accepted

Cannot install python-pip with yum

You have to enable the EPEL repo, use: yum --enablerepo=extras install epel-release This command will install the correct EPEL repository for the CentOS version you are running. After this you will ...
  • 2,243
44 votes
Accepted

How do you install git-filter-repo?

pip install They now have a python package that just works: python3 -m pip install --user git-filter-repo That method installs both the command line executable, and the Python library which you can ...
41 votes
Accepted

What does "precompile standard library" option mean in python installation?

When you import a python library and it doesn't have a corresponding .pyc file (or it's out of date compared to the source), python will "compile" new bytecode. It appears that this option simply does ...
41 votes

Docker / GCloud | How to fix docker-credential-gcloud not installed or not available in PATH?

Opening ~/.docker/config.json and removing the credHelpers object fixed it for me.
  • 523
40 votes

Typing “python” on Windows 10 (version 1903) command prompt opens Microsoft store

Deleting "C:\Users\Username\AppData\Local\Microsoft\WindowsApps\" from the system environment variable, PATH, prevented the Microsoft Store application from launching when I typed python.exe and ...
40 votes
Accepted

VS Code: Shift+Enter does not send code to Python Interactive - why?

I was struggling with the same problem, and finally have found out that it's related to the global settings. If you go to the Settings( Ctrl + , ) you can see the search bar. There, put in 'Send ...
  • 416
38 votes

How to use Latest Python 2.7.x "The Right Way" on Ubuntu 12.04 LTS?

Felix Krull also maintained (as in unmaintained now) a PPA with the latest Python 2.7 release for Ubuntu Precise, Trusty and Utopic. You can use the same process like krondor describes, but use ...
37 votes
Accepted

Run pip for python3 on Fedora

If it is properly installed you can run python3 -m pip to run pip for Python 3. Installing pip for Python 3 is done with dnf install python3-pip. This should create the script /usr/bin/pip3. Using ...
  • 486
35 votes
Accepted

How to build and install Python 3.7.x from source on Debian 9.8

Install git $ sudo apt install git Install Python build dependencies Python includes a set of modules that it builds by linking to other popular open source projects. Many of those projects are ...
  • 671
32 votes

Run pip for python3 on Fedora

I could not run pip3 though my system showed python3-pip as already being installed and I'm using Fedora 22. What I did to get around this was re-install python3-pip like so: dnf reinstall python3-...
30 votes

How to install the win32com python library

Start a command line with admin rights. python -m pip install pywin32 C:\Program Files\Stackless36\Scripts>python pywin32_postinstall.py -install The path C:\Program Files\Stackless36\ should be ...
30 votes

How to run pip in non-interactive mode?

There is a --yes option specifically for the uninstall command. Calling pip uninstall --yes <some-package> uninstalls the package without asking for confirmation. For installing, piping in ...
28 votes

can't uninstall Python 3.6 on windows 10

Solution: UNHIDE ALL FOLDERS BEFORE FOLLOWING DOWN... Go to C:\Users\%USERNAME%\AppData\Local\Programs Delete Python Folder Go to Control Panel >> Uninstall a Program Right Click on Python and ...
26 votes
Accepted

How can I install s3cmd on Mac OS X Yosemite?

Or you can keep it simple and use Homebrew to install/manage many of the AWS tools, including s3cmd Install Homebrew by running this command ruby -e "$(curl -fsSL https://raw.githubusercontent.com/...
  • 3,679
26 votes
Accepted

Create a Python 3 virtual environment

venv is a convenience script to create virtual envs, but does not fully replace everything virtualenv can do. Using either is fine for most cases though. virtualenv is not obsolete. python3 -m venv ...
  • 443
23 votes
Accepted

ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)

TL;DR The remote website seems to be the problem, not Python. There is likely no fix for this other than to fix the website. Longer Explanation The website/server your are dealing with is ...
21 votes

Updating Python on Ubuntu system

sudo apt-get install python 3.3.3 this is for python(3.3.3) for different version the corresponding version number should be used.
  • 319
21 votes
Accepted

How to capture a couple of lines around a regex match?

The following RegEx tests for a variable amount of lines before the XXXXXXXX line and returns them in the first capture group. ((.*(\n|\r|\r\n)){2})XXXXXXXX (.*(\n|\r|\r\n)) tests for a string ending ...
  • 584
18 votes
Accepted

How to install python-pip in CentOS7 Docker Container

Using this in the Dockerfile allowed me to install pip: RUN yum -y install epel-release && yum clean all RUN yum -y install python-pip && yum clean all That seems much cleaner than ...
18 votes
Accepted

pip not working on hombrew python 2.7 install

Generally, homebrew will install a formula into /usr/local/Cellar/formula and then place a link at /usr/local/bin/formula. To make use of your installed formulae, make sure /usr/local/bin is in your $...
17 votes

How to manually stop a Python script that runs continuously on linux

Try this simple line, It will terminate all script.py: pkill -9 -f script.py
  • 325
17 votes

How to syntax highlight python scripts in PHP storm

There is no way to install Python plugin in PHPStorm. Please use IntelliJ IDEA Ultimate to employ all languages (JavaScript, Java, PHP, Python, Ruby, Scala, etc.) support in one environment. If you ...
  • 1,184
17 votes

Installing Python3 on MacOS using Homebrew has error "Failed to import the site module"

I solved this thanks to https://stackoverflow.com/a/42214539/5511915, with a simple unset PYTHONPATH (which was set to PYTHONPATH=/usr/local/lib/python2.7/site-packages, conflicting with python3)
  • 171
17 votes

How do I alias python3 on Windows?

I want to alias python3 to python on Windows. You haven't mentioned what release of Python you are using (e.g. "vanilla" Python, Anaconda, SciPy, etc.), but if I am not misunderstanding, ...

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