Virtualenv返回“没有这样的文件或目录”

时间:2012-12-03 11:16:04

标签: python virtualenv pip ubuntu-12.04

我有很多正常工作的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

1 个答案:

答案 0 :(得分:8)

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