於 Windows 下安裝 OpenCC

不是OpenCV,別看錯了。

什麼是OpenCC? 請到這查看

當你很開心的使用以下指令,你就會踢到一個很痛的鐵版。

1
C:\>pip install opencc-python

然後Python就會跟你抱怨下面的事,

Downloading/unpacking opencc-python
Running setup.py (path:c:\users\xxxx\appdata\local\temp\pip_build_xxxx\opencc-python\setup.py) egg_info for package opencc-python
Traceback (most recent call last):
File “<string>”, line 17, in <module>
File “c:\users\jason\appdata\local\temp\pip_build_xxxx\opencc-python\setup.py”, line 1, in <module>
from distribute_setup import use_setuptools
ImportError: No module named distribute_setup
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

File “<string>”, line 17, in <module>

File “c:\users\jason\appdata\local\temp\pip_build_xxxx\opencc-python\setup.py”, line 1, in <module>

from distribute_setup import use_setuptools

ImportError: No module named distribute_setup

—————————————-
Cleaning up…
Command python setup.py egg_info failed with error code 1 in c:\users\xxxx\appdata\local\temp\pip_build_xxxx\opencc-python
Storing debug log for failure in C:\Users\Jason\pip\pip.log

解法:

下載 distribute_setup.zip

解壓縮後,把distribute_setup.py放到C:\你安裝Python的目錄\Lib(例如:C:\Python27\Lib)

再執行一次

1
C:\>pip install opencc-python

Downloading/unpacking opencc-python
Running setup.py (path:c:\users\xxxx\appdata\local\temp\pip_build_xxxx\opencc-python\setup.py) egg_info for package opencc-python
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.27.tar.gz
Extracting in c:\users\xxxx\appdata\local\temp\tmpeuwfpm
Now working in c:\users\xxxx\appdata\local\temp\tmpeuwfpm\distribute-0.6.27
Building a Distribute egg in c:\users\xxxx\appdata\local\temp\pip_build_xxxx\opencc-python
c:\users\xxxx\appdata\local\temp\pip_build_xxxx\opencc-python\distribute-0.6.27-py2.7.egg

Requirement already satisfied (use –upgrade to upgrade): distribute in c:\python27_x64\lib\site-packages (from opencc-python)
Requirement already satisfied (use –upgrade to upgrade): setuptools>=0.7 in c:\
python27_x64\lib\site-packages (from distribute->opencc-python)
Installing collected packages: opencc-python
Running setup.py install for opencc-python

Successfully installed opencc-python
Cleaning up…

順利完成安裝

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *