Python EPS 可视化错误

Python EPS 可视化错误

我安装了一个名为 YT 的用于数据分析的开源 Python 平台,并尝试运行具有以下导入的 Python 脚本:

import yt
import numpy as np
import yt.visualization.eps_writer as eps
from yt.data_objects.particle_filters import add_particle_filter
from matplotlib import pyplot as plt
plt.switch_backend('agg')

但是,我收到无法找到模块 pyx 的错误:

> Traceback (most recent call last):   File "gasinflow.py", line 3, in
> <module>
>     import yt.visualization.eps_writer as eps   File "/home/samvad/anaconda3/lib/python3.6/site-packages/yt/visualization/eps_writer.py",
> line 16, in <module>
>     import pyx ModuleNotFoundError: No module named 'pyx'

Python 版本:3.6 我遇到过这个问题,Cython 未安装,但 Cython-0.29.7 也已安装。

答案1

看起来你只需要安装 pyx:

~$ pip3 install pyx
Collecting pyx
  Using cached https://files.pythonhosted.org/packages/b4/a0/75d9d39bbd0bcd3aac7bf909b1c356188734a865552607a8c6bba3bf30bd/PyX-0.14.1.tar.gz
Building wheels for collected packages: pyx
  Running setup.py bdist_wheel for pyx ... done
  Stored in directory: $HOME/.cache/pip/wheels/d7/df/3b/33998bf28fc6088c399f64629bcd12f2b129d358f92db5a825
Successfully built pyx
Installing collected packages: pyx
Successfully installed pyx-0.14.1

我建议始终使用它pip来安装模块,因为它可以获取任何模块所需的任何依赖项。

相关内容