我在已经安装了 python (3.6) 和 anaconda 的 EC2 服务器中安装了以下模块:
除了 fastparquet 其他一切都适用于导入。当我尝试导入 fastparquet 时,它会引发以下错误:
[username@ip8 ~]$ conda -V
conda 4.2.13
[username@ip-~]$ python
Python 3.6.0 |Anaconda custom (64-bit)| (default, Dec 23 2016, 12:22:00)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
import fastparquet
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/username/anaconda3/lib/python3.6/site-packages/fastparquet/__init__.py", line 15, in <module>
from .core import read_thrift
File "/home/username/anaconda3/lib/python3.6/site-packages/fastparquet/core.py", line 11, in <module>
from .compression import decompress_data
File "/home/username/anaconda3/lib/python3.6/site-packages/fastparquet/compression.py", line 43, in <module>
compressions['SNAPPY'] = snappy.compress
AttributeError: module 'snappy' has no attribute 'compress'
我该如何解决这个问题?
最佳答案
不幸的是,python 领域有很多东西叫做“snappy”。我相信您可能弄错了,在这种情况下,以下 conda 命令之一应该可以为您解决此问题:
conda install python-snappy
或者
conda install python-snappy -c conda-forge
后者稍微更新一些(发布在线程应用程序中可能很重要的 GIL)。
关于python - 在 python 中导入 fastparquet 时 snappy 出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44301238/