更改easy_install的python路径

0 投票
1 回答
1931 浏览
提问于 2025-04-17 20:06

我在使用Mac电脑,经过多次尝试使用macports后,我决定换回普通的Python路径,所以现在我的Python路径是:

/Library/Frameworks/Python.framework/Versions/2.7/bin/python

但是当我安装Django时,我的Mac还是使用苹果自带的Python,我该怎么告诉easy_install使用上面的Python路径,而不是苹果自带的Python呢:

[~/mysite/djangosite]$sudo easy_install django==1.5
Searching for django==1.5
Best match: Django 1.5
Processing Django-1.5-py2.6.egg
Django 1.5 is already the active version in easy-install.pth
Installing django-admin.py script to /usr/local/bin

Using /Library/Python/2.6/site-packages/Django-1.5-py2.6.egg
Processing dependencies for django==1.5
Finished processing dependencies for django==1.5
anu@localhost:[~/mysite/djangosite]$which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python

我试过用which easy_install来查看正在使用哪个easy_install,结果显示是/usr/bin/easy_install。我还去/Library/Frameworks/Python.framework/Versions/2.7/bin里找easy_install,但没有找到它。

localhost:[/Library/Frameworks/Python.framework/Versions/2.7/bin]$ls
2to3            idle2           pydoc2.7        python2         python2.7-32        pythonw2        smtpd.py
2to3-2          idle2.7         python          python2-32      python2.7-config    pythonw2-32     smtpd2.7.py
2to3-2.7        pydoc           python-32       python2-config      pythonw         pythonw2.7      smtpd2.py
idle            pydoc2          python-config       python2.7       pythonw-32      pythonw2.7-32

/Library/Frameworks/Python.framework/Versions/2.7/bin/easy_install*什么都没有返回。

1 个回答

0

你可以先运行 which easy_install 命令,确保你看到的路径是 /Library/Frameworks/Python.framework/Versions/2.7/bin 下面的那个。如果不是,你可以直接去那个文件夹里运行 easy_install。然后,你就可以在你想要的目录下安装 django 了。

撰写回答