指向正确的python版本时出错:virtualenvwrapper.sh
发布时间:2020-12-20 12:41:12 所属栏目:Python 来源:网络整理
导读:启动终端时出现此错误: Last login: Thu Apr 9 19:49:08 on ttys001/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named virtualenvwrappervirtualenvwrapper.sh: There was a problem runnin
启动终端时出现此错误:
Last login: Thu Apr 9 19:49:08 on ttys001 /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named virtualenvwrapper virtualenvwrapper.sh: There was a problem running the initialization hooks. If Python could not import the module virtualenvwrapper.hook_loader,check that virtualenvwrapper has been installed for VIRTUALENVWRAPPER_PYTHON=/Library/Frameworks/Python.framework/Versions/2.7/bin/python and that PATH is set properly. dhcp-128-189-78-23:~ user_me$ 我需要将我的虚拟环境“指向”我正在使用的python版本. 我怎样才能做到这一点? 解决方法
我有同样的问题,更新我的路径没有任何帮助,也没有设置VIRTUALENVWRAPPER_PYTHON和VIRTUALENVWRAPPER_VIRTUALENV.这是因为我在运行我的python版本时看到了这种奇怪的行为:
$/usr/local/bin/python Python 2.7.6 (v2.7.6:3a1db0d2747e,Nov 10 2013,00:42:54) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help","copyright","credits" or "license" for more information. >>> import sys >>> print sys.executable /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python 通过使用brew卸载python,使用brew重新安装python,并强制它覆盖/usr/local/bin中的现有符号链接,我能够解决所有问题. $brew uninstall --force python $brew install python $brew link --overwrite python $brew linkapps python $pip install --upgrade pip setuptools $sudo pip uninstall virtualenv $pip install virtualenv $sudo pip uninstall virtualenvwrapper $pip install virtualenvwrapper 希望你在六个月前遇到这个问题时能够解决这个问题.我希望发布我的解决方案,以防其他人遇到同样的问题而无法通过设置路径和env变量来解决它. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |