2016-04-14 26 views
2

我使用Windows機器蟒蛇2.7.I我試圖十六進制轉換到彩色name.I下載網頁顏色1.5一封來自PyPI,當我從CMD使用來自pypi的python模塊沒有安裝?

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

我正在爲

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 
安裝

當我運行導入webcolors它顯示沒有模塊錯誤。如何正確安裝這個軟件包?這是'webcolors'軟件包的問題嗎?

編輯 當我安裝使用

pip install webcolors 

我越來越

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

但它仍然沒有顯示出模塊錯誤

編輯 我的代碼

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() 
+0

你試圖通過PIP安裝? –

+0

@HarunErgül我已經安裝了點子。 – Emmanu

+0

我用PIP和我安裝它,我可以導入 –

回答

0

我已經使用pip命令,我安裝了webcolors。

pip install webcolors 

enter image description here
,我可以導入
enter image description here

+2

使用pip working.My問題是我第一次安裝使用setup.py,它創建Egg.info文件在Python Lib.That阻止我安裝使用pip.I刪除該egg.info文件,我用pip重新安裝它的工作。謝謝 – Emmanu

+0

好吧。你解決了你的大部分問題。我什麼也沒做。這是你的第一個問題,很明顯 –