2016-07-01 113 views
3

我试图从PyPi安装PyRTF,但这不起作用。如何用Python3安装PyRTF?

包本身可以发现:

$ pip3 search PyRTF 
PyRTF (0.45) - PyRTF - Rich Text Format Document Generation 

但安装失败:

$ sudo -H pip3 install PyRTF 
Collecting PyRTF 
    Could not find a version that satisfies the requirement PyRTF (from versions:) 
No matching distribution found for PyRTF 

我很困惑。

回答

0

PyRTF有一个名为PyRTF3的Python 3版本。你可以找到它Here。对于Python 2,pip install PyRTF不起作用。

3

你可以使用原始URL从sourceforge的页面,以获得它:

pip install https://sourceforge.net/projects/pyrtf/files/pyrtf/0.45/PyRTF-0.45.tar.gz/download 

不过,说实话,我不认为这个库维护项目网站的最后更新时间为:从2005,11年前..此外,它采用的是线的形式是:

from types import StringType 

只在Python 2.x不存在3.x。导入它引发的特定错误太:

>>> import PyRTF 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/home/jim/anaconda3/lib/python3.5/site-packages/PyRTF/__init__.py", line 1, in <module> 
    from PropertySets import * 
    File "/home/jim/anaconda3/lib/python3.5/site-packages/PyRTF/PropertySets.py", line 12, in <module> 
    from types  import StringType 
ImportError: cannot import name 'StringType' 

因此,也许它是专为Python 2.x?我不记得StringType何时从3.x系列中删除,可能是针对它的旧版本。

+0

就这样,它不起作用?:/ –

+0

看起来很@DavidAndreiNed你可以直接联系作者,看看这个项目的状态是什么。当我给出这个答案时,它在Python'3.5'中不可用。 –