安裝ggplot
1、pip安裝ggplot
python -m pip install -U ggplot (如果你的cmd是管理員運行就不用加-U。還有就是如果你的python版本兼容就不需要加python -m這個,直接pip就可)
報錯:
AttributeError: module 'pandas' has no attribute 'tslib'還有No module named 'pandas.lib'
原因:pandas的tslib被棄用,ggplot太久沒人維護,源碼中沒有做出相應的跟進,需要自己去文件中修改
解決方法:
https://blog.csdn.net/weixin_43886949/article/details/102809595
報錯:
ModuleNotFoundError: No module named 'mpl_toolkits.mplot3d'
解決方法:
python -m pip install mpl_toolkits
報錯:
No module named 'xxx'
解決方法:
在pycharm控制台輸入python -m pip install xxx,沒有安裝的就會安裝最新版本,安裝過的會顯示在哪個路徑下面,比如我的好幾個包都是在anaconda的lib\site-packages下或者是在python37的lib\site-packages下,就把對應的包復制到pycharm運行項目的lib\site-packages中下
報錯:
AttributeError: module 'sip' has no attribute 'setapi'
原因:matplotlib最新版本與其它版本不兼容,我安裝的是最新的3.3.2。有以下兩種解決方法
解決方法:
1.將matplotlib降級
python -m pip install matplotlib==3.3.0
2.因為最新版本應當可以向下兼容,所以還可采用安裝pyqt5解決
python -m pip install pyqt5
具體步驟向下看
使用國內鏡像安裝pyqt5
1、pip 安裝 pyqt5
python -m pip install -U pyqt5
安裝pyqt5,發現pycharm安裝實在太慢了,於是采用國內的鏡像網站下載
目前國內比較好用的pypi源有:
http://mirrors.aliyun.com/pypi/simple/ 阿里雲
http://pypi.douban.com/simple/ 豆瓣
https://pypi.mirrors.ustc.edu.cn/simple/ 中國科技大學
http://pypi.mirrors.opencas.cn/simple/ 中科院
https://pypi.tuna.tsinghua.edu.cn/simple/ 清華大學
2、使用國內pypi源安裝(以豆瓣為例)
安裝完pyqt5之后,發現C:\Users\dell\AppData\Local\Programs\Python\Python37\Lib\site-packages\PyQt5下沒有designer.exe,於是安裝pyqt5-tools,這個里面有designer.exe。仍然采用上述鏡像安裝
python -m pip install pyqt5-tools -i http://pypi.douban.com/simple/需要下載的模塊名
PS:如果pyqt5和pyqt5-tools是安裝在C:\Users\dell\AppData\Local\Programs\Python\Python37\Lib\site-packages\下,就要把相關包復制粘貼在pycharms運行項目對應的\Lib\site-packages路徑下,比如我的就是E:\Pycharm\DateScience\第4章\venv\Lib\site-packages下。
使用pypi源報錯:
The repository located at mirrors.aliyun.com is not a trusted or secure host and is being ignored.
解決方法:
https://blog.csdn.net/Ximerr/article/details/104736271/
安裝pyqt5-tools時報錯:
ERROR: Cannot unpack file C:\Users\admin\AppData\Local\Temp\pip-unpack-yo8pmupp\simple.htm (downloaded from C:\Users\admin\AppData\Local\Temp\pip-req-build-bscsadf5, content-type: text/html); cannot detect archive format ERROR: Cannot determine archive format of C:\Users\admin\AppData\Local\Temp\pip-req-build-bscsadf5

解決方法:
python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn 加你想要下載的東西
例如:我要下載pyqt5-tools
python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn pyqt5-tools
結果如圖:

配置pyqt5的環境變量
pycharm運行調用pyqt5的代碼報錯:
this application failed to start because no Qt platform plugin could be initi...
原因:沒有配置plugins的環境變量
解決方法:
https://www.pianshen.com/article/49361217709/
