2017-07-16 66 views
0

我無法導入pyplot。如何解決錯誤?
最佳無法導入matplotlib pyplot

>>> from matplotlib import pyplot 
Jul 16 12:49:46 Python[35767] <Error>: Set a breakpoint at CGSLogError to catch errors as they are logged. 
Jul 16 12:49:46 Python[35767] <Error>: On-demand launch of the Window Server is allowed for root user only. 
Jul 16 12:49:46 Python[35767] <Warning>: CGSLookupServerRootPort: Failed to look up the port for "com.apple.windowserver.active" (268435459) 
Jul 16 12:49:46 Python[35767] <Error>: On-demand launch of the Window Server is allowed for root user only. 
Jul 16 12:49:46 Python[35767] <Warning>: CGSLookupServerRootPort: Failed to look up the port for "com.apple.windowserver.active" (268435459) 
Jul 16 12:49:46 Python[35767] <Error>: This user is not allowed access to the window system right now. 
_RegisterApplication(), unable to get application ASN from launchservicesd, and this application requires an ASN, so aborting. error=#-1. 
Abort trap: 6 

回答

0

爲了利用圖書館,它需要先安裝。 可以從official site進行安裝。

在Ubuntu中,可以通過把它易於得到:

sudo apt-get install python-matplotlib 

在Windows中,對於標準的Python安裝,使用PIP安裝matplotlib:

python -m pip install -U pip setuptools 
python -m pip install matplotlib