簡體   English   中英

使用Pip安裝Python庫

[英]Installing Python libraries using Pip

在此先感謝您的幫助!

我正在嘗試使用Pip 1.5.2安裝一組Python 2.7.5庫。 我正在按照說明在Mac(OS X Mavericks)上安裝NuPIC 一切順利,直到我執行以下命令:

sudo pip install --allow-all-external --allow-unverified PIL --allow-unverified psutil -r $NUPIC/external/common/requirements.txt

我收到此錯誤:

building '_imagingft' extension

cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -I/usr/local/include/freetype2 -IlibImaging -I/System/Library/Frameworks/Python.framework/Versions/2.7/include -I/usr/local/include -I/usr/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imagingft.c -o build/temp.macosx-10.9-intel-2.7/_imagingft.o

clang: warning: argument unused during compilation: '-mno-fused-madd'

_imagingft.c:73:10: fatal error: 'freetype/fterrors.h' file not found

#include <freetype/fterrors.h>

         ^

1 error generated.

error: command 'cc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip_build_root/PIL/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-vJHHeE-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/tmp/pip_build_root/PIL
Storing debug log for failure in /Users/aaronclaytondunn/Library/Logs/pip.log

這是需求文件($ NUPIC / external / common / requirements.txt):

#See http://www.pip-installer.org/en/latest/requirements.html for details
asteval==0.9.1
mock==1.0.1
ordereddict==1.1
PIL==1.1.7
psutil==1.0.1
pylint==0.28.0
pytest==2.4.2
pytest-cov==1.6
pytest-xdist==1.8
python-dateutil==2.1
PyYAML==3.10
unittest2==0.5.1
validictory==0.9.1
PyMySQL==0.5
DBUtils==1.1
numpy==1.7.1
tweepy==2.1

它運行得很順利一段時間,所以我認為它成功安裝了一些庫並中斷了一個。 任何想法出什么事了嗎?

此處的“鏈接”問題在Mac OS X 10.9上使用pip安裝Python圖像庫時出錯,可以解決此問題(最受好評的答案)。 基本上,PIL不再正確安裝freetype標頭。 您需要將新位置鏈接到/ usr / include / freetype。

fterrors.h    

文件在您的路徑中丟失。 您可以明確下載此文件並將其放置在適當的目錄中。

您可能需要安裝freetype。

brew install freetype

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM