python安装问题
我已尝试从安装python安装问题,python,pandas,homebrew,easy-install,Python,Pandas,Homebrew,Easy Install,我已尝试从安装 源代码(python setup.py安装到提取的tar-ball目录中) 使用pip 使用easy\u install但似乎没有任何效果…我已经下载并升级了xcode,安装了命令行工具 我为熊猫克隆了github存储库 cd ../pandas python setup.py install running install running bdist_egg running egg_info writing requirements to pandas.egg-info/re
python setup.py安装到提取的tar-ball目录中)
pip
easy\u install
但似乎没有任何效果…我已经下载并升级了xcode,安装了命令行工具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
sudo轻松安装
寻找熊猫
最佳匹配:熊猫0.10.1.dev-c934e02
处理pandas-0.10.1.dev_c934e02-py2.7-macosx-10.8-intel.egg
pandas 0.10.1.dev-c934e02已经是easy-install.pth中的活动版本
使用/usr/local/lib/python2.7/site-packages/pandas-0.10.1.dev_c934e02-py2.7-macosx-10.8-intel.egg
处理熊猫的依赖关系
已完成处理熊猫的依赖项
dekumar mn:ipython dekumar$python
Python 2.7.3(v2.7.3:70274d53c1dd,2012年4月9日,20:52:43)
[GCC 4.2.1(苹果公司建造5666)(dot 3)]关于达尔文
有关详细信息,请键入“帮助”、“版权”、“信用证”或“许可证”。
>>>作为pd进口熊猫
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
ImportError:没有名为pandas的模块
您有多个版本的Python 2.7。您为一个版本安装了pandas
,然后尝试将其导入到另一个版本,但您不能这样做,因为它们有单独的站点库
如果出于某种原因需要多个版本的Python 2.7,则必须学习如何管理多个版本的Python。例如,始终确保您使用的是/usr/bin/easy\u install
还是/usr/local/bin/easy\u install
,并使用计划运行的python
附带的
但您可能不需要多个版本。如果你卸载了非苹果的,一切都会简单得多
您可以从日志中的路径中找出详细信息。手动安装转到了/Library/Python/2.7/site-packages
,这就是苹果/usr/bin/Python
的外观。但是easy_安装
转到了/usr/local/lib/python/2.7/site包
,这是第三方(可能是自制的,来自brew
标签?/usr/local/bin/python
的地方。很明显,路径上的第一个python
是/usr/bin/python
,而第一个easy\u install
是/usr/local/bin/easy\u install
。这会导致混乱,就像这里一样
更糟糕的是,如果您将ipython
安装到两个python中,那么第二个安装的任何一个python都将以/usr/local/bin/ipython
结束,这将导致更大的混乱
如果您安装了sudo/usr/bin/easy\u pandas
,您可以在Apple Python中使用pandas
。要确保您运行的是/usr/bin/python
或/usr/bin/python/usr/local/bin/ipython
。如果您安装了sudo/usr/local/bin/easy\u pandas
,您可以在第三方Python中使用pandas
。要确保您运行的是/usr/local/bin/python
或/usr/local/bin/python/usr/local/bin/ipython
查看您的评论和更详细的编辑,这里可能有两个第三方python,这让事情更加混乱。如果他们两个都喜欢/usr/local/bin
(除非你使用MacPorts或Fink,否则他们都喜欢),那么你可能已经让其中一个被另一个覆盖了一半,你根本不可能让它正常工作。如果是这样的话,我建议你做一些激进的事情。如果您不愿意使用OS X的设置导入从头开始安装,至少rm-rf/usr/local/Library/Python~/Library/Python
,然后重新安装brew
和您需要的任何其他第三方软件,这一次请确保只安装一个额外的Python(尽管零还是更好!)
同时,还有两个次要的旁注:
pip
几乎总是比easy\u install
更好。如果您没有它,sudoeasy\u安装pip
,现在就可以了。(这种“几乎”的唯一常见例外是pip
本身和readline
)sudo
。Homebrew在设置它所涉及的所有目录时遇到了很多麻烦,因此您永远不需要sudo
。一旦您开始执行sudo-brew
,sudo/usr/local/bin/easy\u-install
等操作,您最终会破坏这些操作,因此以后的安装会出现权限错误,并且需要使用brew-doctor
进行大量工作才能修复所有问题在python中打印
sys.path
,以确保包含Pandas的路径在/usr/local
中有第二个python 2.7。你从哪里弄来的?你为什么要安装它?你真的需要它吗?我可能已经删除了MacOSX默认版本的python 2.7..,因此不得不使用brew install python重新安装--universalMixing软件包管理器很少是一个好的选择idea@inspectorG4dget:否,Homebrew明确表示始终使用easy\u install
/pip
(和gem
和cpan
),无论您使用的是Python还是Apple。除少数非常特殊的情况外,它没有Python/Ruby/Perl模块的配方。有关详细信息,请参阅。非常感谢..但很可能我已损坏/覆盖了默认的mac osx Python版本..因此,我没有卸载非Apple版本的选项..将进行审阅您对如何更仔细地将/usr/local/bin中的内容与其他路径中的二进制文件区分开来的评论,并回答..为什么您认为