本人使用的操作系统是Ubuntu17.04,Python3.7 按照网站上的安装方法安装matplotlib,安装好后,在使用时出现以下问题:
>>> import matplotlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/space-wa/.local/lib/python3.7/site-packages/matplotlib/__init__.py", line 134, in <module>
import subprocess
File "/usr/lib/python3.7/subprocess.py", line 152, in <module>
import _posixsubprocess
ModuleNotFoundError: No module named '_posixsubprocess'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 12, in <module>
import subprocess, tempfile, os.path, re, pwd, grp, os, time
File "/usr/lib/python3.7/subprocess.py", line 152, in <module>
import _posixsubprocess
ModuleNotFoundError: No module named '_posixsubprocess'
Original exception was:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/space-wa/.local/lib/python3.7/site-packages/matplotlib/__init__.py", line 134, in <module>
import subprocess
File "/usr/lib/python3.7/subprocess.py", line 152, in <module>
import _posixsubprocess
ModuleNotFoundError: No module named '_posixsubprocess'
按照提示,我直接对这个包进行重新安装,期待将旧的版本替代,但是还是出现同样的问题。