文章詳情頁
Python安裝docx依賴包教程
瀏覽:69日期:2022-06-25 11:13:02
方法一、
主要問題是docx受lxml的影響,如果lxml的版本不對的話,docx根本裝不上,不管你用pip,easy_install或者是用源代碼包來裝。
要到https://pypi.python.org/simple/lxml/去下載相應的lxml版本,安裝之后直接pip install python-docx就可以安裝上了!
方法二、如果安裝的是python2.6需要將python升級到2.7,然后pip install python-docx命令安裝即可
補充:Python-docx安裝失敗
報錯:’libxml/xmlversion.h’ file not found
先在終端輸入:
xcode-select ?install
會提示安裝,安裝
然后再
pip install python-docx
如果再報:
error: could not create ‘/Library/Python/2.7/site-packages/lxml’: Permission denied
就加上sudo,如下:
sudo pip install python-docx
至此,本人已解決!
以上為個人經驗,希望能給大家一個參考,也希望大家多多支持好吧啦網。如有錯誤或未考慮完全的地方,望不吝賜教。
相關文章:
排行榜
