gpt4 book ai didi

python - 安装 OS X Mavericks 后使用 mkvirtualenv 时出现问题

转载 作者:太空宇宙 更新时间:2023-11-03 13:44:51 25 4
gpt4 key购买 nike

我最近安装了 OS X Mavericks。我可以访问我以前创建的虚拟环境,但我无法创建新环境:

Christophers-MacBook-Pro-2:~ christopherspears$ mkvirtualenv bottle_todo
-bash: /usr/local/bin/virtualenv: /usr/local/opt/python/bin/python2.7: bad interpreter: No such file or directory

我查看了/usr/local/bin/virtualenv:

#!/usr/local/opt/python/bin/python2.7
# EASY-INSTALL-ENTRY-SCRIPT: 'virtualenv==1.10.1','console_scripts','virtualenv'
__requires__ = 'virtualenv==1.10.1'
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
sys.exit(
load_entry_point('virtualenv==1.10.1', 'console_scripts', 'virtualenv')()
)

果然路径/usr/local/opt/python/bin/python2.7没有退出。早些时候,我有这个问题:

Terminal issue with virtualenvwrapper after Mavericks Upgrade

我尝试更新 virtualenv 但没有成功:

christohersmbp2:~ christopherspears$ pip install virtualenv
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /Library/Python/2.7/site-packages
Cleaning up...
christohersmbp2:~ christopherspears$ pip install --upgrade virtualenv
Requirement already up-to-date: virtualenv in /Library/Python/2.7/site-packages
Cleaning up...
christohersmbp2:~ christopherspears$ mkvirtualenv test
-bash: /usr/local/bin/virtualenv: /usr/local/opt/python/bin/python2.7: bad interpreter: No such file or directory

最佳答案

我修好了。我不得不卸载并重新安装 virtualenv:

christohersmbp2:bin christopherspears$ sudo pip uninstall virtualenv
Password:
Uninstalling virtualenv:
/Library/Python/2.7/site-packages/virtualenv-1.11.4.dist-info/DESCRIPTION.rst
/Library/Python/2.7/site-packages/virtualenv-1.11.4.dist-info/METADATA
/Library/Python/2.7/site-packages/virtualenv-1.11.4.dist-info/RECORD
/Library/Python/2.7/site-packages/virtualenv-1.11.4.dist-info/WHEEL
/Library/Python/2.7/site-packages/virtualenv-1.11.4.dist-info/entry_points.txt
/Library/Python/2.7/site-packages/virtualenv-1.11.4.dist-info/pydist.json
/Library/Python/2.7/site-packages/virtualenv-1.11.4.dist-info/top_level.txt
/Library/Python/2.7/site-packages/virtualenv.py
/Library/Python/2.7/site-packages/virtualenv.pyc
/Library/Python/2.7/site-packages/virtualenv_support/__init__.py
/Library/Python/2.7/site-packages/virtualenv_support/__init__.pyc
/Library/Python/2.7/site-packages/virtualenv_support/pip-1.5.4-py2.py3-none-any.whl
/Library/Python/2.7/site-packages/virtualenv_support/setuptools-2.2-py2.py3-none-any.whl
/usr/local/bin/virtualenv
/usr/local/bin/virtualenv-2.7
Proceed (y/n)? y
Successfully uninstalled virtualenv
christohersmbp2:bin christopherspears$ sudo pip install virtualenv
Downloading/unpacking virtualenv
Downloading virtualenv-1.11.4-py2.py3-none-any.whl (1.7MB): 1.7MB downloaded
Installing collected packages: virtualenv
Successfully installed virtualenv
Cleaning up...

现在一切似乎都正常了:

christohersmbp2:bin christopherspears$ cat virtualenv
#!/usr/bin/python

# -*- coding: utf-8 -*-
import re
import sys

from virtualenv import main

if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())
christohersmbp2:bin christopherspears$ mkvirtualenv test
New python executable in test/bin/python
Installing setuptools, pip...done.

(test)christohersmbp2:bin christopherspears$ deactivate
christohersmbp2:bin christopherspears$ workon
bottle_tutorial
rango_tutorial
scrapestat
test
christohersmbp2:bin christopherspears$ rmvirtualenv test
Removing test...

关于python - 安装 OS X Mavericks 后使用 mkvirtualenv 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22238170/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com