1

我試過了所有我能做的,但現在我需要幫助!我已經達到了我所理解的極限。VIRTUALENV bash:/ usr/local/bin/virtualenv:/ usr/bin/python:糟糕的解釋器:沒有這樣的文件或目錄

我的錯誤:

andytmac:~ admin$ lsvirtualenv 
andytmac:~ admin$ mkvirtualenv test 
-bash: /usr/local/bin/virtualenv: /usr/bin/python: bad interpreter: No such file or directory 

我的看法是,virtualenv中不知道在哪裏巨蟒。是這樣嗎?我怎樣才能解決這個問題?

系統是Mac OSX版10.9.4

我已經使用BREW安裝Python 2.7.8.1。 - Python 2.7 *東西*在那裏,但我刪除它。但我不記得我做了什麼,但是。抱歉。我是蘋果新手。 - 這個新的Python實例就坐落在這裏:/usr/local/Cellar/python/2.7.8_1/ - 該/usr/local/bin/python文件時,我的readlink在/ usr/local/bin目錄/蟒蛇它指向上述

的.bash_profile:

export PROJECT_HOME=$HOME/Projects 
export PATH=$PATH:/usr/local/bin 
export PATH=$PATH:/usr/local/bin/psql 
export PYTHONPATH=$PYTHONPATH:/usr/local/bin/python 

export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python 
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv 
export WORKON_HOME=$HOME/.virtualenvs 
source /usr/local/bin/virtualenvwrapper.sh 

alias showhidden='defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder' 
alias hidehidden='defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder' 

路徑:

andytmac:~ admin$ cat /etc/paths 
/usr/local/bin 
/usr/bin 
/bin 
/usr/sbin 
/sbin 

的Python似乎工作,但路徑看起來很忙

Python 2.7.8 (default, Aug 24 2014, 21:26:19) 
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import sys 
>>> print sys.path 
['', '/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg', '/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg', '/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-5.4.2-py2.7.egg', '/usr/local/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg', '/usr/local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg', '/usr/local/lib/python2.7/site-packages/setuptools-5.4.2-py2.7.egg', '/Users/admin', '/usr/local/Cellar/python/2.7.8_1', '/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/site-packages'] 

任何幫助表示讚賞!

感謝,

安迪


這將會嚴重.....幫助!這不僅是因爲我搞砸的鏈接,我覺得這是一個問題,這些鏈接

andytmac:~ admin$ ln -s /usr/bin/python /System/Library/Frameworks/Python.framework/Versions/2.7 
ln: /System/Library/Frameworks/Python.framework/Versions/2.7: Permission denied 
andytmac:~ admin$ sudo ln -s /usr/bin/python /System/Library/Frameworks/Python.framework/Versions/2.7 
Password: 
andytmac:~ admin$ readlink /System/Library/Frameworks/Python.framework/Versions/2.7 
/usr/bin/python 
andytmac:~ admin$ readlink /usr/bin/python 
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python 
andytmac:~ admin$ sudo ln - s /usr/local/Cellar/python/2.7.8_1/ user/bin/python 
ln: user/bin/python: No such file or directory 
andytmac:~ admin$ sudo ln - s /usr/local/Cellar/python/2.7.8_1 /usr/bin/python 
ln: /usr/bin/python: Too many levels of symbolic links 
andytmac:~ admin$ readlink /usr/bin/python 
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python 
andytmac:~ admin$ sudo ln - s /usr/local/Cellar/python/2.7.8_1 /System/Library/Frameworks/Python.framework/Versions/2.7 
ln: /System/Library/Frameworks/Python.framework/Versions/2.7: Too many levels of symbolic links 
andytmac:~ admin$ python 

我原本以爲它。我改變了以下鏈接。但它仍然是擰緊的。

Andytmac:~ admin$ readlink /System/Library/Frameworks/Python.framework/Versions/Current 
/System/Library/Frameworks/Python.framework/Versions/2.7 
Andytmac:~ admin$ readlink /System/Library/Frameworks/Python.framework/Versions/2.7 
/usr/bin/python 
Andytmac:~ admin$ readlink /usr/bin/python 
/usr/local/Cellar/python/2.7.8_1 
Andytmac:~ admin$ virtualenv ENV 
-bash: /usr/local/bin/virtualenv: /usr/bin/python: bad interpreter: Permission denied 
Andytmac:~ admin$ 

我現在最好停止我做任何更多的損害。

我將/ usr/bin/python改爲指向/usr/local/Cellar/python/2.7.8_1/bin python2。7:

Andytmac:~ admin$ readlink /usr/bin/python 
/usr/local/Cellar/python/2.7.8_1/bin/python2.7 

沒有錯誤已經發展到了下面:

Andytmac:~ admin$ lsvirtualenv 
Andytmac:~ admin$ mkvirtualenv Test 
Traceback (most recent call last): 
    File "/usr/local/bin/virtualenv", line 5, in <module> 
    from pkg_resources import load_entry_point 
    File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 2876, in <module> 
    File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 451, in _build_master 
    File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 464, in _build_from_requirements 
    File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 639, in resolve 
pkg_resources.DistributionNotFound: virtualenv==1.10.1 
+0

? – Kasramvd 2014-08-30 17:05:07

+0

我以前安裝過它。添加任何以上我意識到。我有一個我想要的環境,但我可以沒有它。所有這一切開始,因爲我想要與Heroku的官方2.7相同的Python版本,這不是案件 – 2014-08-30 17:13:55

+0

看到這個鏈接http://stackoverflow.com/questions/25024874/how-would-i-run-lsvirtualenv-or-any-的最其他-virtualenvwrapper - 功能 - 通過 – Kasramvd 2014-08-30 17:22:28

回答

1

解決如下:

  1. 系統通過下載恢復和重新安裝Maverics(使用自動蘋果啓動工具)
  2. 按照這裏的建議: Can't pip install virtualenv in OS X 10.8 with brewed python 2.7 and here: http://www.lowindata.com/2013/installing-scientific-python-on-mac-os-x/
  3. 我的virtualenv是在一個不同的位置,在頁中指定(2),所以在.bash_profile應包含 源/usr/local/bin/virtualenvwrapper.sh 代替: 源的/ usr /本地/共享/蟒蛇爲什麼你使用`lsvirtualenv`/virtualenvwrapper.sh
相關問題