3

首先让我说我是编程、mac osx 和 bash 的新手。

我很难在我的 Mac osx 10.7.3 上设置 virtualenvwrapper。它最肯定是一个路径设置问题,但我只是无法让它工作。

在 .bashrc 中设置 virtualenvwrapper

export WORKON_HOME=$HOME/.Apps
source /usr/local/bin/virtualenvwrapper.sh

一些终端输出:

which easy_install
/usr/bin/easy_install

python -V
Python 2.7.1

当我在终端中运行“source .bashrc”时,我没有得到任何输出。

当我在终端中运行 mkvirtualenv 时,我得到:

Error [Errno 2] No such file or directory while executing command install_name_tool -change /System/Library/Fram.../Versions/2.7/Python @executable_path/../.Python 1/bin/python
Could not call install_name_tool -- you must have Apple's development tools installed
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 9, in <module>
    load_entry_point('virtualenv==1.7.1.2', 'console_scripts', 'virtualenv')()
  File "/Library/Python/2.7/site-packages/virtualenv-1.7.1.2-py2.7.egg/virtualenv.py", line 928, in main
    never_download=options.never_download)
  File "/Library/Python/2.7/site-packages/virtualenv-1.7.1.2-py2.7.egg/virtualenv.py", line 1029, in create_environment
    site_packages=site_packages, clear=clear))
  File "/Library/Python/2.7/site-packages/virtualenv-1.7.1.2-py2.7.egg/virtualenv.py", line 1347, in install_python
    py_executable])
  File "/Library/Python/2.7/site-packages/virtualenv-1.7.1.2-py2.7.egg/virtualenv.py", line 966, in call_subprocess
    cwd=cwd, env=env)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 672, in __init__
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1202, in _execute_child
OSError: [Errno 2] No such file or directory 
4

1 回答 1

3

您可能只需要安装XCode。它应该是从 App Store 免费下载/安装的(如果很大的话)。

为了将来参考,我强烈建议在 OS X 上使用包管理器和 pip(而不是 easy_install)进行 python 开发。我首选的包管理器是Homebrew,但MacPortsFink也不错。除其他外,pip 允许您卸载东西,而 easy_install 不能简单地做到这一点。

于 2012-04-07T14:49:21.197 回答