I'm trying to use the regex package in my python script, using:
import regex as re and the package is missing:
$ ./lula2.py Traceback (most recent call last): File "./lula2.py", line 13, in <module> import regex as re ImportError: No module named regex I'm trying to install it, and receive the following error/failure:
$ sudo apt install regex Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package regex $ sudo apt install python-pip Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package python-pip Please let me know how to install regex.
1 Answer
python-pip and python-regex packages are in universe repository. Enable that using:
sudo add-apt-repository universe sudo apt update Then install regex:
sudo apt install python-regex #For Python 2 sudo apt install python3-regex #For Python 3 If you want to install regex using pip:
Install pip:
sudo apt install python-pip #For Python 2 sudo apt install python3-pip #For Python 3And then regex:
pip install regex #For Python 2 pip3 install regex #For Python 3