2

I am using windows machine python 2.7.I am trying to convert hex to color name.I have downloaded webcolors 1.5 from pypi,When i install it from cmd using

python d:\webcolors-1.5\setup.py install

I am getting as

setup.pyrunning install
running build
running build_py
file webcolors.py (for module webcolors) not found
file webcolors.py (for module webcolors) not found
running install_lib
warning: install_lib: 'build\lib' does not exist -- no Python modules to install
running install_egg_info
Removing C:\Python27\Lib\site-packages\webcolors-1.5-py2.7.egg-info
Writing C:\Python27\Lib\site-packages\webcolors-1.5-py2.7.egg-info

when I run import webcolors it shows no module error.How to correctly install this package?Is it the problem with that 'webcolors' package?

Edit When i install using

pip install webcolors

I am getting

Requirement already satisfied (use --upgrade to upgrade): webcolors in c:\python27\lib\site-packages

But it still shows no module error

Edit my code

import cv2
from collections import namedtuple
from math import sqrt
import random
import webcolors

def main():
 img = cv2.imread('d:/Emmanu/project-data/bu5.jpg')
 res=cv2.resize(img,(400,300))
 crop_img = res[100:200, 150:250]
 cv2.imwrite("d:/Emmanu/project-data/color-test.jpg", crop_img)

 im = Image.open("d:/Emmanu/project-data/color-test.jpg")
 n, color = max(im.getcolors(im.size[0]*im.size[1]))
 print rgb_to_name(color)
if __name__ == '__main__':main()
8
  • have you tried installing by pip? Commented Apr 14, 2016 at 5:41
  • @HarunErgül I have installed pip. Commented Apr 14, 2016 at 5:45
  • I used pip and i install it and i can import Commented Apr 14, 2016 at 5:46
  • is it possible two show related place in your code Commented Apr 14, 2016 at 5:48
  • @HarunErgül ok.You installed using 'pip install webcolors' this command? Commented Apr 14, 2016 at 5:48

1 Answer 1

1

I have used pip command and i installed webcolors.

pip install webcolors

enter image description here
And i can import
enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

using pip worked.My problem was i first installed using setup.py and it created Egg.info files in python Lib.That prevented me from installing using pip.I deleted that egg.info files and i reinstalled using pip it worked.Thanks
Ok. You solved most of your problems. I did nothing.It is your first question and it is clear

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.