[英]How to install PyRTF with Python3?
I tried to install PyRTF
from PyPi but this doesn't work. 我试图从PyPi安装
PyRTF
,但这不起作用。
The package itself can be found: 包装本身可以找到:
$ pip3 search PyRTF
PyRTF (0.45) - PyRTF - Rich Text Format Document Generation
But installing it fails: 但安装失败:
$ 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
I am confused. 我很迷惑。
You could use the raw url from the sourceforge page in order to get it: 您可以使用sourceforge页面中的原始URL来获取它:
pip install https://sourceforge.net/projects/pyrtf/files/pyrtf/0.45/PyRTF-0.45.tar.gz/download
But, to be honest, I don't think this library is maintained on the project website the last update was from 2005
, 11 years ago.. Additionally, it uses a line of the form: 但是,说实话,我不认为这个库是在项目网站上维护的,最后一次更新是从
2005
,11年前开始的。另外,它使用了以下形式的一行:
from types import StringType
which only exists in Python 2.x
not 3.x
. 它只存在于Python
2.x
而不是3.x
。 Importing it raises that specific error too: 导入它也会引发特定错误:
>>> 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'
So maybe it was designed for Python 2.x
? 那么也许它是为
Python 2.x
设计的? I can't remember when StringType
was removed from the 3.x
series, maybe it targeted an old version of it. 我不记得何时从
3.x
系列中删除了StringType
,可能是针对它的旧版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.