Glam Prestige Journal

Bright entertainment trends with youth appeal.

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.

2

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 3
  • And then regex:

    pip install regex #For Python 2
    pip3 install regex #For Python 3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy