2017-04-02 214 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 .