Reputation: 61
I need to test black
check in travis.yml file which is having python2.7 version how to install black in that?
language: python
python:
- '2.7'
install:
- pip install black
Upvotes: 6
Views: 9066
Reputation: 3125
Black requires Python 3.6+ and you may want to look at pre-commit as it is capable of creating a python3 virtual environment just for black.
Upvotes: 3
Reputation: 1314
pip3 install --user black[python2]
With python2
option black
will check py2 code correctly, but for running black you need py3
Upvotes: 1
Reputation: 33147
Did you try?
pip install black
Black can be installed by running pip install black. It requires Python 3.6.0+ to run but you can reformat Python 2 code with it, too.
Ref: https://black.readthedocs.io/en/stable/installation_and_usage.html
Based on this topic (https://github.com/psf/black/issues/439) Black requires python 3.6 to run.
Try pip3 install black
if python3 and pip3 are installed.
Upvotes: 0