I'm trying to use the regex package in my python script, using:
import regex as reand 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 regexI'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-pipPlease 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 updateThen install regex:
sudo apt install python-regex #For Python 2
sudo apt install python3-regex #For Python 3If 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