2017-04-02 265 views
0

我想在Python 3.6.1中安裝ffmpeg-normalize。這似乎在Python 2.7.13中正常工作,但不是最新版本。ffmpeg-normalize pip安裝失敗

在提升的命令提示符I型:pip install ffmpeg-normalize

我繼續得到Command "python setup.py egg_info" failed with error code 1出於某種原因,我不知道這意味着什麼......

C:\Users\Arete>python --version 
Python 3.6.1 

C:\Users\Arete>pip install ffmpeg-normalize 
Collecting ffmpeg-normalize 
    Using cached ffmpeg-normalize-0.4.3.tar.gz 
    Complete output from command python setup.py egg_info: 
    Traceback (most recent call last): 
     File "<string>", line 1, in <module> 
     File "C:\Users\Arete\AppData\Local\Temp\pip-build-rcxpzvv4\ffmpeg-normalize\setup.py", line 7, in <module> 
     readme = readme_file.read() 
     File "c:\program files\python36\lib\encodings\cp1252.py", line 23, in decode 
     return codecs.charmap_decode(input,self.errors,decoding_table)[0] 
    UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 2117: character maps to <undefined> 

    ---------------------------------------- 
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Arete\AppData\Local\Temp\pip-build-rcxpzvv4\ffmpeg-normalize\ 

C:\Users\Arete> 

我使用Windows 10和我已經嘗試accepted answer on a very similar question沒有任何運氣...

這是什麼原因造成這個問題,我怎樣才能得到ffmpeg-normalize安裝?

回答

2

這看起來像我在setup.py中的一個bug。由於在文本模式下打開文件時,python 3中使用的默認編碼是平臺相關的,因此應明確提供編碼。否則,read操作的結果將是不可預知的,如果默認編碼無法處理文件內容,則操作將失敗,就像您的情況一樣。

您應該能夠通過查看源代碼和改變這一行來解決這個問題:

with open('README.rst') as readme_file: 

使用UTF-8

with open('README.rst', encoding='utf8') as readme_file: 

要安裝打開命令提示符,cd到包含setup.py的目錄,然後:

pip install .