我尝试了很长时间在这台 Mac 上使用 python。我试图从我的 mac 中完全删除 python。然后我意识到很难摆脱这个默认的python。幸运的是,我在互联网上读到,在我弄清楚如何删除它之前删除它是一个坏主意。然后我还使用 *.dmg 包安装了 python、numpy、scipy、matplotlib。经过所有的努力,我每次导入pylab时仍然收到此错误消息。请帮我?任何人?
$python
Python 2.7.4 (v2.7.4:026ee0057e2d, Apr 6 2013, 11:43:10)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylab
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "/Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/matplotlib/pylab.py", line 221, in <module>
`from matplotlib import mpl # pulls in most modules
File "/Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/matplotlib/mpl.py", line 2, in <module>
`from matplotlib import axis
File "/Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/matplotlib/axis.py", line 14, in <module>
`import matplotlib.text as mtext
File "/Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/matplotlib/text.py", line 31, in <module>
`from matplotlib.backend_bases import RendererBase
File "/Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/matplotlib/backend_bases.py", line 48, in <module>
`import matplotlib.textpath as textpath
File "/Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/matplotlib/textpath.py", line 9, in <module>
`from matplotlib.mathtext import MathTextParser
File "/Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/matplotlib/mathtext.py", line 52, in <module>
`import matplotlib._png as _png
ImportError: dlopen(/Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/matplotlib/_png.so, 2): Library not loaded: /opt/local/lib/libpng14.14.dylib
Referenced from: /Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/matplotlib/_png.so
Reason: image not found
此外,我按照http://ipython.org/install.html上的说明安装 Anaconda。安装 Anaconda 后,我进入下一步
$ conda update conda
得到了这个
"-bash: conda: command not found"
我在网上搜索,但似乎没有其他人有这个问题。有人可以在这里给我一个提示吗?非常感谢!
在我的目录 /usr/bin 我有
python python-config python2.5 python2.5-config python2.6 python2.6-config python2.7 python2.7-config
使用命令 which python
我有/Library/Frameworks/Python.framework/Versions/2.7/bin/python
与哪个 ipython
我有/Library/Frameworks/Python.framework/Versions/2.7/bin/ipython
对于 numpy,我下载了 numpy-1.7.0-py2.7-python.org-macosx10.6.dmg 包,scipy-0.12.0-py2.7-python.org-macosx10.6.dmg 用于 scipy 和 matplotlib -1.2.0-py2.7-python.org-macosx10.6.dmg 用于 matplotbib。我下载了 *10.6.dmg 因为这就是我发现的......我找不到像 *10.7.dmg 这样的东西
我没有 .bashrc 或 .bashrc_profile。但我认为 .profile 会做,它看起来像这样
# MacPorts Installer addition on 2012-03-07_at_18:55:26: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
export TERM="xterm-color"
alias ls="ls -G"
export PS1="[\[\e[33m\]\u@\H \[\e[32m\]\w\[\e[0m\]]\n[\[\e[31m\]\!\[\e[0m\]] > "
# Setting PATH for Python 2.7
# The orginal version is saved in .profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
当我输入
$端口
它说这-bash: port: command not found
应该让我担心吗?我也可以评论一下吗
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
也?