JuPyter(IPython) Notebook中通過pip安裝第三方Python Module


JuPyter(IPython) Notebooks中使用pip安裝Python的模塊

剛開始接觸JuPyter Notebook的時候覺得這是個不錯的寫技術博客的工具,可以很直觀的把代碼和結果結合在一起。於是想着趁熱打鐵,把前段時間學習PyQuery的經驗總結一下分享出來。可是IPython里默認沒有PyQuery模塊,而且不能直接運行pip去安裝。查了一下StackOverflow之后終於找到了下面的代碼,運行之后就可以在JuPyter Notebook里使用PyQuery了。

import pip

def install(package):
   pip.main(['install', package])

install('pyquery') 

輸出:

Requirement already satisfied (use --upgrade to upgrade): pyquery in c:\users\alvin\anaconda3\lib\site-packages
Requirement already satisfied (use --upgrade to upgrade): lxml>=2.1 in c:\users\alvin\anaconda3\lib\site-packages (from pyquery)
Requirement already satisfied (use --upgrade to upgrade): cssselect>0.7.9 in c:\users\alvin\anaconda3\lib\site-packages (from pyquery)


You are using pip version 7.1.2, however version 8.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM