3

我有许多正常工作的 virtualenvs,但从今天开始,它们给了我一个错误。我尝试使用 easy_install -U 重新安装 pip 和 virtualenvwrapper,但错误仍然存​​在。有任何想法吗?

$ mkvirtualenv django
sh: 0: getcwd() failed: No such file or directory
New python executable in django/bin/python
Installing setuptools.............done.
Installing pip...............done.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenvwrapper/hook_loader.py", line 16, in <module>
    from stevedore import ExtensionManager
  File "/usr/local/lib/python2.7/dist-packages/stevedore/__init__.py", line 1, in <module>
    from .extension import ExtensionManager
  File "/usr/local/lib/python2.7/dist-packages/stevedore/extension.py", line 4, in <module>
    import pkg_resources
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2697, in <module>
    _declare_state('object', working_set = WorkingSet())
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 435, in __init__
    self.add_entry(entry)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 450, in add_entry
    for dist in find_distributions(entry, True):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1723, in find_on_path
    path_item = _normalize_cached(path_item)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1872, in _normalize_cached
    _cache[filename] = result = normalize_path(filename)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1866, in normalize_path
    return os.path.normcase(os.path.realpath(filename))
  File "/usr/lib/python2.7/posixpath.py", line 375, in realpath
    return abspath(filename)
  File "/usr/lib/python2.7/posixpath.py", line 347, in abspath
    cwd = os.getcwd()
OSError: [Errno 2] No such file or directory
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 70, in apport_excepthook
    binary = os.path.realpath(os.path.join(os.getcwdu(), sys.argv[0]))
OSError: [Errno 2] No such file or directory

Original exception was:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenvwrapper/hook_loader.py", line 16, in <module>
    from stevedore import ExtensionManager
  File "/usr/local/lib/python2.7/dist-packages/stevedore/__init__.py", line 1, in <module>
    from .extension import ExtensionManager
  File "/usr/local/lib/python2.7/dist-packages/stevedore/extension.py", line 4, in <module>
    import pkg_resources
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2697, in <module>
    _declare_state('object', working_set = WorkingSet())
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 435, in __init__
    self.add_entry(entry)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 450, in add_entry
    for dist in find_distributions(entry, True):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1723, in find_on_path
    path_item = _normalize_cached(path_item)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1872, in _normalize_cached
    _cache[filename] = result = normalize_path(filename)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1866, in normalize_path
    return os.path.normcase(os.path.realpath(filename))
  File "/usr/lib/python2.7/posixpath.py", line 375, in realpath
    return abspath(filename)
  File "/usr/lib/python2.7/posixpath.py", line 347, in abspath
    cwd = os.getcwd()
OSError: [Errno 2] No such file or directory
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenvwrapper/hook_loader.py", line 16, in <module>
    from stevedore import ExtensionManager
  File "/usr/local/lib/python2.7/dist-packages/stevedore/__init__.py", line 1, in <module>
    from .extension import ExtensionManager
  File "/usr/local/lib/python2.7/dist-packages/stevedore/extension.py", line 4, in <module>
    import pkg_resources
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2697, in <module>
    _declare_state('object', working_set = WorkingSet())
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 435, in __init__
    self.add_entry(entry)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 450, in add_entry
    for dist in find_distributions(entry, True):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1723, in find_on_path
    path_item = _normalize_cached(path_item)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1872, in _normalize_cached
    _cache[filename] = result = normalize_path(filename)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1866, in normalize_path
    return os.path.normcase(os.path.realpath(filename))
  File "/usr/lib/python2.7/posixpath.py", line 375, in realpath
    return abspath(filename)
  File "/usr/lib/python2.7/posixpath.py", line 347, in abspath
    cwd = os.getcwd()
OSError: [Errno 2] No such file or directory
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 70, in apport_excepthook
    binary = os.path.realpath(os.path.join(os.getcwdu(), sys.argv[0]))
OSError: [Errno 2] No such file or directory

Original exception was:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenvwrapper/hook_loader.py", line 16, in <module>
    from stevedore import ExtensionManager
  File "/usr/local/lib/python2.7/dist-packages/stevedore/__init__.py", line 1, in <module>
    from .extension import ExtensionManager
  File "/usr/local/lib/python2.7/dist-packages/stevedore/extension.py", line 4, in <module>
    import pkg_resources
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2697, in <module>
    _declare_state('object', working_set = WorkingSet())
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 435, in __init__
    self.add_entry(entry)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 450, in add_entry
    for dist in find_distributions(entry, True):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1723, in find_on_path
    path_item = _normalize_cached(path_item)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1872, in _normalize_cached
    _cache[filename] = result = normalize_path(filename)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1866, in normalize_path
    return os.path.normcase(os.path.realpath(filename))
  File "/usr/lib/python2.7/posixpath.py", line 375, in realpath
    return abspath(filename)
  File "/usr/lib/python2.7/posixpath.py", line 347, in abspath
    cwd = os.getcwd()
OSError: [Errno 2] No such file or directory
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenvwrapper/hook_loader.py", line 16, in <module>
    from stevedore import ExtensionManager
  File "/usr/local/lib/python2.7/dist-packages/stevedore/__init__.py", line 1, in <module>
    from .extension import ExtensionManager
  File "/usr/local/lib/python2.7/dist-packages/stevedore/extension.py", line 4, in <module>
    import pkg_resources
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2697, in <module>
    _declare_state('object', working_set = WorkingSet())
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 435, in __init__
    self.add_entry(entry)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 450, in add_entry
    for dist in find_distributions(entry, True):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1723, in find_on_path
    path_item = _normalize_cached(path_item)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1872, in _normalize_cached
    _cache[filename] = result = normalize_path(filename)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1866, in normalize_path
    return os.path.normcase(os.path.realpath(filename))
  File "/usr/lib/python2.7/posixpath.py", line 375, in realpath
    return abspath(filename)
  File "/usr/lib/python2.7/posixpath.py", line 347, in abspath
    cwd = os.getcwd()
OSError: [Errno 2] No such file or directory
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 70, in apport_excepthook
    binary = os.path.realpath(os.path.join(os.getcwdu(), sys.argv[0]))
OSError: [Errno 2] No such file or directory

Original exception was:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenvwrapper/hook_loader.py", line 16, in <module>
    from stevedore import ExtensionManager
  File "/usr/local/lib/python2.7/dist-packages/stevedore/__init__.py", line 1, in <module>
    from .extension import ExtensionManager
  File "/usr/local/lib/python2.7/dist-packages/stevedore/extension.py", line 4, in <module>
    import pkg_resources
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2697, in <module>
    _declare_state('object', working_set = WorkingSet())
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 435, in __init__
    self.add_entry(entry)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 450, in add_entry
    for dist in find_distributions(entry, True):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1723, in find_on_path
    path_item = _normalize_cached(path_item)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1872, in _normalize_cached
    _cache[filename] = result = normalize_path(filename)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1866, in normalize_path
    return os.path.normcase(os.path.realpath(filename))
  File "/usr/lib/python2.7/posixpath.py", line 375, in realpath
    return abspath(filename)
  File "/usr/lib/python2.7/posixpath.py", line 347, in abspath
    cwd = os.getcwd()
OSError: [Errno 2] No such file or directory
4

1 回答 1

9

您正在尝试virtualenv在已删除的目录中运行。重新创建目录,或使用cd转至现有目录。

于 2012-12-03T12:06:57.857 回答