[英]python pandas installation issues
我試過安裝
python setup.py install
到提取的tar球目錄中) pip
easy_install
但似乎沒什么用......我已下載並升級了xcode,安裝了命令行工具.. 我克隆了pandas的github存儲庫
cd ../pandas
python setup.py install
running install
running bdist_egg
running egg_info
writing requirements to pandas.egg-info/requires.txt
writing pandas.egg-info/PKG-INFO
writing top-level names to pandas.egg-info/top_level.txt
writing dependency_links to pandas.egg-info/dependency_links.txt
reading manifest file 'pandas.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'setupegg.py'
no previously-included directories found matching 'doc/build'
warning: no previously-included files matching '*.so' found anywhere in distribution
warning: no previously-included files matching '*.pyd' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '.DS_Store' found anywhere in distribution
writing manifest file 'pandas.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.6-intel/egg
running install_lib
running build_py
copying pandas/version.py -> build/lib.macosx-10.6-intel-2.7/pandas
running build_ext
**gcc-4.2 not found, using clang instead**
building 'pandas.index' extension
clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include -Ipandas/src/klib -Ipandas/src -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pandas/index.c -o build/temp.macosx-10.6-intel-2.7/pandas/index.o
In file included from pandas/index.c:260:
In file included from pandas/src/klib/khash_python.h:3:
pandas/src/klib/khash.h:573:1: warning: expression result unused [-Wunused-value]
KHASH_MAP_INIT_STR(str, size_t)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pandas/src/klib/khash.h:565:2: note: expanded from macro 'KHASH_MAP_INIT_STR'
KHASH_INIT(name, kh_cstr_t, khval_t, 1, kh_str_hash_func, kh_str_hash_equal)
^
-更多這樣的輸出...最后
Installed /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site- packages/pandas-0.10.1.dev_c934e02-py2.7-macosx-10.6-intel.egg
Processing dependencies for pandas==0.10.1.dev-c934e02
Searching for pytz
Reading http://pypi.python.org/simple/pytz/
Reading http://pytz.sourceforge.net
Reading http://sourceforge.net/project/showfiles.php?group_id=79122
Reading http://www.stuartbishop.net/Software/pytz
Reading http://sourceforge.net/projects/pytz/
Best match: pytz 2012h
Downloading http://pypi.python.org/packages/2.7/p/pytz/pytz-2012h-py2.7.egg#md5=4258fcfc023e9ff0057405d935fc6e1d
Processing pytz-2012h-py2.7.egg
creating /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pytz-2012h-py2.7.egg
Extracting pytz-2012h-py2.7.egg to /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Adding pytz 2012h to easy-install.pth file
Installed /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pytz-2012h-py2.7.egg
-----
Installed /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/six-1.2.0-py2.7.egg
Searching for numpy==1.6.2
Best match: numpy 1.6.2
Adding numpy 1.6.2 to easy-install.pth file
Using /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Finished processing dependencies for pandas==0.10.1.dev-c934e02
ipython
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43)
Type "copyright", "credits" or "license" for more information.
IPython 0.14.dev -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import pandas
似乎沒有問題..
當我使用easy_install安裝pandas時,屏幕輸出似乎表明它工作但是在加載時,python無法找到庫
sudo easy_install pandas
Searching for pandas
Best match: pandas 0.10.1.dev-c934e02
Processing pandas-0.10.1.dev_c934e02-py2.7-macosx-10.8-intel.egg
pandas 0.10.1.dev-c934e02 is already the active version in easy-install.pth
Using /usr/local/lib/python2.7/site-packages/pandas-0.10.1.dev_c934e02-py2.7-macosx-10.8-intel.egg
Processing dependencies for pandas
Finished processing dependencies for pandas
dekumar-mn:ipython dekumar$ python
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas as pd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pandas
您有多個版本的Python 2.7。 您為一個版本安裝了pandas
,然后嘗試將其導入另一個版本,並且您無法執行此操作,因為它們具有單獨的站點庫。
如果出於某種原因需要多個版本的Python 2.7,則必須學習如何管理多個版本的Python。 例如,始終確定您是使用/usr/bin/easy_install
還是/usr/local/bin/easy_install
,並使用與您計划運行的python
一起使用的那個。
但是你可能不需要多個版本。 如果您只卸載非Apple的產品,那么一切將變得容易得多。
您可以從日志中的路徑中找出詳細信息。 手動安裝到/Library/Python/2.7/site-packages
,這是Apple的/usr/bin/python
外觀。 但是easy_install
轉到/usr/local/lib/python/2.7/site-packages
,這是第三方(大概是Homebrew,來自brew
標簽) /usr/local/bin/python
。 顯然,路徑上的第一個python
是/usr/bin/python
,而第一個easy_install
是/usr/local/bin/easy_install
。 這會導致混亂,就像它在這里所做的那樣。
更糟糕的是,如果你將ipython
安裝到兩個Pythons中,那么你安裝的第二個將最終成為/usr/local/bin/ipython
,這將導致更多的混亂。
如果你做了sudo /usr/bin/easy_install pandas
,你可以在Apple Python中使用pandas
。 為了確保運行該命令,請始終執行/usr/bin/python
或/usr/bin/python /usr/local/bin/ipython
。 如果你做sudo /usr/local/bin/easy_install pandas
,你可以在第三方Python中使用pandas
。 為了確保運行該命令,請始終執行/usr/local/bin/python
或/usr/local/bin/python /usr/local/bin/ipython
。
看看你的評論和更詳細的編輯,你可能在這里實際上有兩個第三方Pythons,這讓事情變得更加混亂。 如果他們兩個都喜歡/usr/local/bin
(除非你使用的是MacPorts或Fink,否則他們會這樣做),你可能會讓其中一個被另一個半覆蓋,並且你無法繼續讓這個工作。 如果是這樣的話,我會建議你做一些激進的事情。 如果您不願意從OS X進行從頭開始安裝 - 至少rm -rf /usr/local /Library/Python ~/Library/Python
,那么重新安裝brew
和任何其他第三個你需要的一些東西,這次確保只安裝一個額外的Python(雖然零仍然會更好!)。
同時,兩個小方注:
使用pip
比使用easy_install
幾乎總是更好。 如果沒有,請使用sudo easy_install pip
,現在就可以了。 (“幾乎”的唯一常見例外是pip
本身和readline
。)
不要將sudo
與Homebrew一起使用。 Homebrew經歷了很多麻煩來設置它觸及的所有目錄,所以你永遠不需要sudo
。 一旦你開始做sudo brew
, sudo /usr/local/bin/easy_install
等,你最終會破壞它,因此以后的安裝會獲得權限錯誤,並且需要與brew doctor
一起修復所有內容。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.