我正在使用我使用 pip 在 virtulaenv 中使用 python 3.4 安装的 petl 包。当我试图测试在 python shell 中是否正确安装了 petl 包时,我已经这样做来检查
$ python
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from petl import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/user/.env/lib/python3.4/site-packages/petl/__init__.py", line 10, in <module>
from petl.util import header, fieldnames, data, records, rowcount, look, see, \
File "/home/user/.env/lib/python3.4/site-packages/petl/util.py", line 14, in <module>
from string import maketrans
ImportError: cannot import name 'maketrans'
>>>
我试图检查 maketrans 是否存在于我运行的字符串包中
>>> from string import maketrans
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'maketrans'
>>>
发现默认python字符串包没有这个。我不确定为什么 petl 包在其依赖项中没有提及它而使用它,如果它是默认的 python 包,那么为什么它会给出导入错误。
不知道发生了什么可以请任何人帮忙