導航:首頁 > 編程語言 > mac安裝python39第三方庫

mac安裝python39第三方庫

發布時間:2022-05-10 20:02:53

python 第三方庫怎麼安裝

【方法一】: 通過setuptools來安裝python模塊
首先下載
NOTE: 最好下載個setuptools,本人是15.2版本,裡麵包含了ez_setup
運行 python ez_setup.py
D:\work\installation\setuptools-15.2\setuptools-15.2>python ez_setup.py > 1.txt
Extracting in c:\users\admini~1\appdata\local\temp\tmpbxikxf
Now working in c:\users\admini~1\appdata\local\temp\tmpbxikxf\setuptools-15.2
Installing Setuptools
......
Copying setuptools-15.2-py2.7.egg to c:\python27\lib\site-packages
setuptools 15.2 is already the active version in easy-install.pth
Installing easy_install-script.py script to C:\Python27\Scripts
Installing easy_install.exe script to C:\Python27\Scripts
Installing easy_install-2.7-script.py script to C:\Python27\Scripts
Installing easy_install-2.7.exe script to C:\Python27\Scripts

Installed c:\python27\lib\site-packages\setuptools-15.2-py2.7.egg
Processing dependencies for setuptools==15.2
Finished processing dependencies for setuptools==15.2

運行 easy_install py
D:\work>easy_install py #py 為第三方庫文件
Searching for py
Best match: py 1.4.26
Adding py 1.4.26 to easy-install.pth file

Using c:\python27\lib\site-packages
Processing dependencies for py
Finished processing dependencies for py

【方法二】: 通過pip來安裝python模塊
安裝 easy_install pip
D:\work>easy_install pip
Searching for pip
Best match: pip 6.1.1
Processing pip-6.1.1-py2.7.egg
pip 6.1.1 is already the active version in easy-install.pth
Installing pip-script.py script to C:\Python27\Scripts
Installing pip.exe script to C:\Python27\Scripts
Installing pip2.7-script.py script to C:\Python27\Scripts
Installing pip2.7.exe script to C:\Python27\Scripts
Installing pip2-script.py script to C:\Python27\Scripts
Installing pip2.exe script to C:\Python27\Scripts

Using c:\python27\lib\site-packages\pip-6.1.1-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip

運行 pip install xlrd
Usage:
pip <command> [options]

Commands:
install Install packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
search Search PyPI for packages.
wheel Build wheels from your requirements.
zip DEPRECATED. Zip indivial packages.
unzip DEPRECATED. Unzip indivial packages.
help Show help for commands.

General Options:
-h, --help Show help.
--isolated Run pip in an isolated mode, ignoring
environment variables and user configuration.
-v, --verbose Give more output. Option is additive, and can be
used up to 3 times.
-V, --version Show version and exit.
-q, --quiet Give less output.
--log <path> Path to a verbose appending log.
--proxy <proxy> Specify a proxy in the form
[user:passwd@]proxy.server:port.
--retries <retries> Maximum number of retries each connection should
attempt (default 5 times).
--timeout <sec> Set the socket timeout (default 15 seconds).
--exists-action <action> Default action when a path already exists:
(s)witch, (i)gnore, (w)ipe, (b)ackup.
--trusted-host <hostname> Mark this host as trusted, even though it does
not have valid or any HTTPS.
--cert <path> Path to alternate CA bundle.
--client-cert <path> Path to SSL client certificate, a single file
containing the private key and the certificate
in PEM format.
--cache-dir <dir> Store the cache data in <dir>.
--no-cache-dir Disable the cache.
--disable-pip-version-check
Don't periodically check PyPI to determine
whether a new version of pip is available for
download. Implied with --no-index.

【方法三】:直接從網上下載下可執行文件來安裝.
比如說,去 >>> pythonlibs <<< 網站,提供了很多Python非官方包下載,二進制文件,下載安裝方便.

❷ Mac電腦里的anaconda prompt在哪裡如何安裝第三方庫

Mac 下的anaconda prompt就是自帶的terminal。為了能夠使用需要在.bash_profile或者.zshrc(當使用zsh替代bash的時候)裡面設置好相應的anaconda路徑。參考Stack Overflow高贊解答

❸ python第三方庫安裝到哪裡

1、首先通過pip安裝的第三方庫,一般都在python安裝路徑下的Libsite-packages目錄,這里可以通過pip安裝一個第三方庫看一下,如下圖所示。

❹ 在Mac系統下python如何安裝第三方函數庫

最簡單的方式是使用Python的pip包管理器,pip可以自動根據包的名稱搜索並下載包,安裝包時,自動先安裝所依賴的包,十分簡單方便。
linux中可以使用以下代碼安裝pip包管理器:
sudo apt-get install python-pip

安裝好pip包管理器後,安裝包就可以使用簡單的一條語句
pip install 包名稱

使用
pip list

可以查看已經安裝好的包。

❺ 如何在mac上安裝python

安裝前必須知道的工作:
1、MAC OS 一般都自帶 MAC Python,Apple自己擴展的版本。例如,Lion是64位Python版本,自帶與Objctive C庫的介面模塊以及Apple系統的介面模塊。但安裝第三方與C、Fortran等相關的的Python模塊時,就必須從源碼編譯或使用專門編譯的64位二進制發行版。
2、安裝Python官方程序。從兼容的角度,Mac上可以安裝官方2.X版本。官方程序對MAC的支持和UNIX是一樣的,但與第三方模塊的兼容性無疑會更有保障。通常可以直接安裝許多二進制發行版。
3、本文關注在MAC Python上安裝Scipy等模塊。如果你使用官方Python版本,請直接訪問官方網站。
安裝工作:
1、安裝gFortran。由於部分庫函數是用Fortran實現的,所以要安裝與Xcode4.2兼容的Fortran編譯器。目前,沒有官方版本,請在這里下載。安裝後就可以使用gFortran了。如果你使用Xcode4.1或以前版本,請直接按Scipy官方網頁指令安裝。
2、自己從源代碼編譯,通常會需要解決太多問題。已有人編譯了實用於Lion和雪豹的64位版本,網頁這里。在命令行中使用如下命令下載:
$ git clone git://github.com/fonnesbeck/ScipySuperpack
下載目錄中包含安裝腳本和一組*.egg文件。
3、使用BBEdit或其他文本編輯工具編輯install_superpack.sh,刪除安裝Fortran的那段腳本。然後保存。
4、在命令行中使用如下命令:
$ sh install_superpack.sh
輸入y。 (不要輸入n!!!和網頁上說明的不一樣)
輸入你的開機密碼(管理員許可權),然後就自動安裝好了。
5、測試。輸入python
>>>import numpy as np
>>>np.test('full')
>>>import scipy
>>>scipy.test()
注意:有一些failure。

❻ mac如何安裝python3

mac上自帶了python2.7 但是由於工作需要需要安裝python3。如何安裝python3,接下來手把手教你!

可以參考這篇Python安裝文章:《python3安裝詳細步驟》

有2種方法:推薦使用homebrew安裝。

相關推薦:《Python基礎教程》

方法一:

步驟一:Mac 上有個很牛的包管理工具:home-brew 可以一鍵安裝你所需要的軟體。homebrew 的安裝一句命令就可以解決,打開terminal:

/usr/bin/ruby -e "$(curl -fsSL

https://raw.githubusercontent.com/Homebrew/install/master/install)"

安裝完後檢查下:brew doctor 輸出:「Your system is ready to brew」 表示安裝成功。

步驟二:安裝python3 ,在terminal輸入命令即可。

1、查找python3 ,命令:brew search python3。

2、安裝python3,命令:brew install python3。接下來就是等待,當輸出表示安裝完成。

3、配置環境變數,命令:open .bash_profile 在打開的文件窗口粘貼以下內容:

PATH=/usr/local/Cellar/python/3.6.5/bin:${PATH}

export PATH

保存關閉文件,就完成整個python3的安裝,查看版本命令:python3 -V。

方法二:

官網下載安裝包,直接運行安裝。官網:https://www.python.org/downloads/mac-osx/

下載最新版本直接安裝即可。

方法二不推薦原因:python沒有在brew的管理之下,後續卸載起來和麻煩。

❼ 如何在安裝pip3以及第三方python庫

在安裝pip3以及第三方python庫(for Mac)
環境
OS:10.12.3 (16D32) macOS Sierra
Python3: Python 3.6.1
什麼是pip
Python之所以強大,其中一個原因是其豐富的第三方庫。pip則是python第三方庫的包管理工具。
由於在Mac上python2和python3是共存的。因而python3對應的包管理工具的命令就是:pip3如何安裝pip3如果通過homebrew安裝python3,那麼pip3會同時安裝。所以建議直接通過homebrew安裝python3:
$brew install python3//no need sudo
如果你已經通過其他渠道安裝了python3但是尚未安裝pip3,那麼需要通過以下步驟實現安裝:
https : // pip.readthedocs .io/en/stable/installing/上述的鏈接是官方給出的方法,但是有幾個地方需要注意,最好按照我博客一步步來:
https : // bootstrap .pypa .io/get-pip.py
復制粘貼另存為鏈接中的文本,可以保存為get-pip.py。
注意:其中內容很多,必須等網頁載入完再復制,然後通過已經安裝的python3解釋器解釋執行另存為的文件$python3 get-pip.py再次執行上述命令,顯示:
Requirement already up-to-date: pip in /usr/local/lib/python3.6/site-packages1安裝成功
如何安裝第三方庫
有了pip3以後,安裝第三方庫就容易多了,比如:
$pip3 install requests
Collecting requests
Downloading requests-2.13.0-py2.py3-none-any.whl (584kB)100% |████████████████████████████████| 593kB 298kB/sInstalling collected packages: requestsSuccessfully installed requests-2.13.0

❽ 如何在MAC系統下的python中導入第三方庫,如lxml和requests

lxml 模塊不是內置的,需要先安裝才能使用。

lxml安裝依賴

python-devel,libxml2-devel,libxslt-devel,
裝好之後,下載

tar zxvf lxml-2.2.8.tgz,
然後python setup.py install即可
/

❾ 如何安裝python的第三方模塊

在Python中,安裝第三方模塊,是通過setuptools這個工具完成的。Python有兩個封裝了setuptools的包管理工具:easy_install和pip。目前官方推薦使用pip。
如果你正在使用Mac或Linux,安裝pip本身這個步驟就可以跳過了。
如果你正在使用Windows,請參考安裝Python一節的內容,確保安裝時勾選了pip和Add python.exe to Path。
在命令提示符窗口下嘗試運行pip,如果Windows提示未找到命令,可以重新運行安裝程序添加pip。
現在,讓我們來安裝一個第三方庫——Python Imaging Library,這是Python下非常強大的處理圖像的工具庫。一般來說,第三方庫都會在Python官方的pypi.python.org網站注冊,要安裝一個第三方庫,必須先知道該庫的名稱,可以在官網或者pypi上搜索,比如Python Imaging Library的名稱叫PIL,因此,安裝Python Imaging Library的命令就是:
pip install PIL

耐心等待下載並安裝後,就可以使用PIL了。
有了PIL,處理圖片易如反掌。隨便找個圖片生成縮略圖:
>>> import Image
>>> im = Image.open('test.png')
>>> print im.format, im.size, im.mode
PNG (400, 300) RGB
>>> im.thumbnail((200, 100))
>>> im.save('thumb.jpg', 'JPEG')

其他常用的第三方庫還有MySQL的驅動:MySQL-python,用於科學計算的NumPy庫:numpy,用於生成文本的模板工具Jinja2,等等。
模塊搜索路徑
當我們試圖載入一個模塊時,Python會在指定的路徑下搜索對應的.py文件,如果找不到,就會報錯:
>>> import mymole
Traceback (most recent call last):
File "<stdin>", line 1, in <mole>
ImportError: No mole named mymole

默認情況下,Python解釋器會搜索當前目錄、所有已安裝的內置模塊和第三方模塊,搜索路徑存放在sys模塊的path變數中:
>>> import sys
>>> sys.path
['', '/Library/Python/2.7/site-packages/pycrypto-2.6.1-py2.7-macosx-10.9-intel.egg', '/Library/Python/2.7/site-packages/PIL-1.1.7-py2.7-macosx-10.9-intel.egg', ...]

如果我們要添加自己的搜索目錄,有兩種方法:
一是直接修改sys.path,添加要搜索的目錄:
>>> import sys
>>> sys.path.append('/Users/michael/my_py_scripts')

這種方法是在運行時修改,運行結束後失效。
第二種方法是設置環境變數PYTHONPATH,該環境變數的內容會被自動添加到模塊搜索路徑中。設置方式與設置Path環境變數類似。注意只需要添加你自己的搜索路徑,Python自己本身的搜索路徑不受影響。

閱讀全文

與mac安裝python39第三方庫相關的資料

熱點內容
管家婆輝煌2加密狗挪到另一台電腦 瀏覽:760
摩托車在哪裡app看考題 瀏覽:356
蘋果5app在哪裡設置 瀏覽:737
如何查看伺服器的磁碟使用 瀏覽:165
python蒙特卡洛模型投點圖 瀏覽:330
安卓手機屬於什麼介面 瀏覽:742
微信群推廣網站源碼 瀏覽:764
九江離鷹潭源碼 瀏覽:719
python可以當作函數的返回值 瀏覽:422
地鐵逃生體驗服怎麼進入安卓 瀏覽:833
齊魯工惠app的中獎記錄在哪裡 瀏覽:759
linuxkill命令詳解 瀏覽:103
dhcp伺服器動態分配地址 瀏覽:265
門禁卡加密了能破解嗎 瀏覽:215
在哪裡下載百度網盤app 瀏覽:917
伺服器要升級什麼意思 瀏覽:831
銀行還房貸解壓方法 瀏覽:702
伺服器主機辦公如何提速 瀏覽:920
cad列印為pdf 瀏覽:418
賣手錶的app哪裡可以賣 瀏覽:55