7

Today I see a python file starting with

import sys
import time
import heapq
import resource
from itertools import groupby
from collections import defaultdict

however, after I run the file, the error showed with

ImportError: No module named resource 

then I try to install resource with pip install but cannot find such packages.

Any idea could be helpful!

3
  • 1
    try pip install python-resources Commented Mar 12, 2018 at 10:10
  • 3
    Possible duplicate of ImportError: No module named 'resource' Commented Mar 12, 2018 at 10:16
  • 4
    resource is built in on UNIX systems. You are probably on windows, where it is not available Commented Mar 12, 2018 at 10:16

3 Answers 3

7

You can use

pip install python-resources

or download the package form here and then install from the downloaded file

pip install python-resources-0.3.tar.gz
Sign up to request clarification or add additional context in comments.

Comments

3

To suppress the pylint import error (Windows), add the following pylint hint. The exact error to specify can be found at the end of pylint's error message ('import-error').

 if os.name == 'posix':
     import resource # pylint: disable=import-error

Comments

2

I had the same Issue , but reading official[github repo] helps to resolve it on windows 10,

try replace import resource to import rsrc

since the original name is conflict with the built-in library resource:

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.