<p>我正在尝试用easy_install安装一个新模块。</p>
<p>当我运行类似于</p>
<pre><code>sudo easy_install foo
</code></pre>
<p>foo安装到<code>~/Library/Python/2.7/site-packages/</code>。</p>
<p>这似乎是错误的,因为我不能使用python shell中安装的任何模块。</p>
<p>根据我在阅读了一些与easy_install问题相关的SO文章后的理解,正确的目录应该是<code>/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages</code>
,因为我的python shell使用了<code>/usr/local/bin/python</code>,它象征性地链接到所述目录。</p>
<p>如何告诉easy_install使用此目录而不是当前目录?</p>
<p>谢谢你</p>
<p>朱利安</p>
<p><strong>编辑:</strong>我使用<code>-d /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages</code>选项重新运行setuptools安装。结果如下:</p>
<pre><code>Processing setuptools-0.6c11-py2.7.egg
Removing /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg
Copying setuptools-0.6c11-py2.7.egg to /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
setuptools 0.6c11 is already the active version in easy-install.pth
Installing easy_install script to /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Installing easy_install-2.7 script to /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Installed /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg
Processing dependencies for setuptools==0.6c11
Finished processing dependencies for setuptools==0.6c11
</code></pre>
<p>例如<code>sudo easy_install mechanize</code>的输出是</p>
<pre><code>Searching for mechanize
Best match: mechanize 0.2.5
Processing mechanize-0.2.5-py2.7.egg
mechanize 0.2.5 is already the active version in easy-install.pth
Using /Users/julian/Library/Python/2.7/site-packages/mechanize-0.2.5-py2.7.egg
Processing dependencies for mechanize
Finished processing dependencies for mechanize
</code></pre>
<p>似乎easy_install仍然使用错误的目录?!非常感谢你的帮助。谢谢您。</p>