2013-05-15 46 views
1

我之前遇到了一個問題,試圖在我的virtualenv中安裝gevent。我嘗試了幾個不同的東西,包括一些導出命令,安裝XCode命令行工具,安裝GCC編譯器...都沒有工作。Virtualenv正試圖在系統目錄中安裝

在這個過程中,我設法搞砸了我的virtualenv安裝。我已經刪除了virtualenv目錄,並試圖重新創建它,但沒有運氣。我卸載並重新安裝了virtualenv(使用pip),並且在運行以下命令後仍然出現以下錯誤。

命令:

virtualenv ENV 

我想知道爲什麼它尋找/資源庫在安裝目錄。有什麼地方可以解決這個問題嗎?

UPDATE V2:刪除虛擬捲餅

輸出繼電器與--verbose:

Creating ENV/lib/python2.7 
Symlinking Python bootstrap modules 
Symlinking ENV/lib/python2.7/config 
Symlinking ENV/lib/python2.7/lib-dynload 
Symlinking ENV/lib/python2.7/os.py 
Ignoring built-in bootstrap module: posix 
Symlinking ENV/lib/python2.7/posixpath.py 
Cannot import bootstrap module: nt 
Symlinking ENV/lib/python2.7/ntpath.py 
Symlinking ENV/lib/python2.7/genericpath.py 
Symlinking ENV/lib/python2.7/fnmatch.py 
Symlinking ENV/lib/python2.7/locale.py 
Symlinking ENV/lib/python2.7/encodings 
Symlinking ENV/lib/python2.7/codecs.py 
Symlinking ENV/lib/python2.7/stat.py 
Symlinking ENV/lib/python2.7/UserDict.py 
Symlinking ENV/lib/python2.7/copy_reg.py 
Symlinking ENV/lib/python2.7/types.py 
Symlinking ENV/lib/python2.7/re.py 
Symlinking ENV/lib/python2.7/sre.py 
Symlinking ENV/lib/python2.7/sre_parse.py 
Symlinking ENV/lib/python2.7/sre_constants.py 
Symlinking ENV/lib/python2.7/sre_compile.py 
Symlinking ENV/lib/python2.7/warnings.py 
Symlinking ENV/lib/python2.7/linecache.py 
Symlinking ENV/lib/python2.7/_abcoll.py 
Symlinking ENV/lib/python2.7/abc.py 
Symlinking ENV/lib/python2.7/_weakrefset.py 
Creating ENV/lib/python2.7/site-packages 
Writing ENV/lib/python2.7/site.py 
Writing ENV/lib/python2.7/orig-prefix.txt 
Writing ENV/lib/python2.7/no-global-site-packages.txt 
Creating parent directories for ENV/include 
Symlinking ENV/include/python2.7 
Creating ENV/bin 
New python executable in ENV/bin/python 
Changed mode of ENV/bin/python to 0755 
Symlinking ENV/.Python 
Testing executable with ENV/bin/python -c "import sys;out=sys.stdout;getattr(out, "buffer", out).write(sys.prefix.encode("utf-8"))" 
Got sys.prefix result: u'/Users/aharwood/Documents/SUCode/mds-item-read-svc/ENV' 
Creating ENV/lib/python2.7/distutils 
Writing ENV/lib/python2.7/distutils/__init__.py 
Writing ENV/lib/python2.7/distutils/distutils.cfg 
Using existing setuptools egg: /Library/Python/2.7/site-packages/virtualenv-1.9.1-py2.7.egg/virtualenv_support/setuptools-0.6c11-py2.7.egg 
Installing setuptools... 
error: can't create or remove files in install directory 
The following error occurred while trying to add or remove files in the 
installation directory: 
    [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-3535.write-test' 
The installation directory you specified (via --install-dir, --prefix, or 
the distutils default setting) was: 
    /Library/Python/2.7/site-packages/ 
Perhaps your account does not have write access to this directory? If the 
installation directory is a system-owned directory, you may need to sign in 
as the administrator or "root" account. If you do not have administrative 
access to this machine, you may wish to choose a different installation 
directory, preferably one that is listed in your PYTHONPATH environment 
variable. 
For information on other options, you may wish to consult the 
documentation at: 
    http://peak.telecommunity.com/EasyInstall.html 
Please make the appropriate changes for your system and try again. 
Complete output from command /Users/aharwood/Docu...d-svc/ENV/bin/python -c "#!python 
\"\"\"Bootstra...sys.argv[1:]) 






" /Library/Python/2.7/...ols-0.6c11-py2.7.egg: 
error: can't create or remove files in install directory 

The following error occurred while trying to add or remove files in the 
installation directory: 

[Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-3535.write-test' 

The installation directory you specified (via --install-dir, --prefix, or 
the distutils default setting) was: 

/Library/Python/2.7/site-packages/ 

Perhaps your account does not have write access to this directory? If the 
installation directory is a system-owned directory, you may need to sign in 
as the administrator or "root" account. If you do not have administrative 
access to this machine, you may wish to choose a different installation 
directory, preferably one that is listed in your PYTHONPATH environment 
variable. 

For information on other options, you may wish to consult the 
documentation at: 

http://peak.telecommunity.com/EasyInstall.html 

Please make the appropriate changes for your system and try again. 

---------------------------------------- 
...Installing setuptools...done. 
Traceback (most recent call last): 
    File "/usr/local/bin/virtualenv", line 8, in <module> 
load_entry_point('virtualenv==1.9.1', 'console_scripts', 'virtualenv')() 
File "/Library/Python/2.7/site-packages/virtualenv-1.9.1-py2.7.egg/virtualenv.py", line 979, in main 
no_pip=options.no_pip) 
File "/Library/Python/2.7/site-packages/virtualenv-1.9.1-py2.7.egg/virtualenv.py", line 1091, in create_environment 
search_dirs=search_dirs, never_download=never_download) 
File "/Library/Python/2.7/site-packages/virtualenv-1.9.1-py2.7.egg/virtualenv.py", line 611, in install_setuptools 
search_dirs=search_dirs, never_download=never_download) 
File "/Library/Python/2.7/site-packages/virtualenv-1.9.1-py2.7.egg/virtualenv.py", line 583, in _install_req 
cwd=cwd) 
File "/Library/Python/2.7/site-packages/virtualenv-1.9.1-py2.7.egg/virtualenv.py", line 1057, in call_subprocess 
% (cmd_desc, proc.returncode)) 
OSError: Command /Users/aharwood/Docu...d-svc/ENV/bin/python -c "#!python 
\"\"\"Bootstra...sys.argv[1:]) 






" /Library/Python/2.7/...ols-0.6c11-py2.7.egg failed with error code 1 

UPDATE V3:我發現的東西我也嘗試安裝GEVENT之一。這會導致我的問題嗎?

sudo port install libevent 
CFLAGS="-I /opt/local/include -L /opt/local/lib" pip install gevent 
+0

我認爲你的'virtualenv'仍然是hosed:而不是嘗試在env中安裝setuptools,它是系統範圍內安裝(由於權限不足而失敗)。嘗試運行'virtualenv --verbose ENV'來查看日誌中是否有可能提供線索的東西。 – robertklep

回答

0

這行看起來可疑:

Using existing setuptools egg: /Users/aharwood/.venvburrito/lib/python/virtualenv-1.9.1-py2.7.egg/virtualenv_support/setuptools-0.6c11-py2.7.egg 

您是否積極使用virtualenv-burrito?我不確定它到底在做什麼,但是looking at the install file它改變了你的shell的啓動命令,這可能會導致你的問題。

我會嘗試並將其移出的方式,打開一個新的終端窗口,看看運行的virtualenv重新正常工作:

mv ~/.venvburrito ~/.venvburrito.disabled 

如果能夠解決你的問題,你可以更永久刪除:

rm -fr ~/.venvburrito.disabled 

它還安裝在這些文件中的一個部分代碼(取決於你的shell):

~/.bash_profile 
~/.zprofile 
~/.profile 

你可以刪除該代碼,但它看起來像它不會導致任何問題,如果你把它放進去。

+0

呼叫良好。我開始遇到這個問題後,實際上安裝了virtualburrito,希望它能取代我遇到的問題。我會刪除它,希望能爲我做點事情。 – malandro95

+0

我刪除了虛擬捲餅,但仍然收到相同的錯誤。新的輸出在上面。 – malandro95