简体   繁体   中英

Install Pyicu in python 3.x

My system is Windows 10 x64

Now I would like to install pyicu but I encounter with a problem like this

Collecting pyicu

Using cached PyICU-1.9.7.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "C:\\Users\\ANHVU\\AppData\\Local\\Temp\\pip-build-v5fb9ri4\\pyicu\\setup.py", line 12, in ICU_VERSION = os.environ['ICU_VERSION'] File "C:\\Users\\ANHVU\\AppData\\Local\\Programs\\Python\\Python35\\lib\\os.py", line 725, in getitem raise KeyError(key) from None KeyError: 'ICU_VERSION'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\ANHVU\AppData\Local\Temp\pip-build-v5fb9ri4\pyicu\setup.py", line 26, in <module>
    ICU_VERSION = check_output(('icu-config', '--version')).strip()
  File "C:\Users\ANHVU\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 316, in check_output
    **kwargs).stdout
  File "C:\Users\ANHVU\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 383, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Users\ANHVU\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 676, in __init__
    restore_signals, start_new_session)
  File "C:\Users\ANHVU\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 955, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\ANHVU\AppData\Local\Temp\pip-build-v5fb9ri4\pyicu\setup.py", line 33, in <module>
    ''')
RuntimeError:
Please set the ICU_VERSION environment variable to the version of
ICU you have installed.

How can I resolve this? Help me pls.

You can download a corresponding whl file from Unofficial Windows Binaries for Python Extension Packages

For example, the latest version (as of Jan 13 2019) for your 64-bit Windows and Python3.7 version is PyICU‑2.2‑cp37‑cp37m‑win_amd64.whl

Then open the Windows Powershell console as Administrator, cd to the directory where you put the whl file and execute the following command:

python -m pip install .\PyICU‑2.2‑cp37‑cp37m‑win_amd64.whl

or (if you already have a previous PyICU version installed)

python -m pip install -U .\PyICU‑2.2‑cp37‑cp37m‑win_amd64.whl

For the record:

My system (Win 10, 64 bit, python 3.8) gave me the exact same error message.

The solution was to install the 32-bit version of the PyICU whl file, not the 64 bit version.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM