设置virtualenv的问题

时间:2011-05-05 06:28:44

标签: python virtualenv virtualenvwrapper

我正在尝试使用Python 2.6.5在Ubuntu 10.04上设置virtualenv但有一些问题。

用pip安装virtualenv和virtualenv包装器后,我正在运行命令:virtualenv mysite-env --verbose

我收到以下错误:

Creating mysite-env/lib/python2.6
Symlinking Python bootstrap modules
  Symlinking mysite-env/lib/python2.6/lib-dynload
  Symlinking mysite-env/lib/python2.6/config
  Symlinking mysite-env/lib/python2.6/os.py
  Ignoring built-in bootstrap module: posix
  Symlinking mysite-env/lib/python2.6/posixpath.py
  Cannot import bootstrap module: nt
  Symlinking mysite-env/lib/python2.6/ntpath.py
  Symlinking mysite-env/lib/python2.6/genericpath.py
  Symlinking mysite-env/lib/python2.6/fnmatch.py
  Symlinking mysite-env/lib/python2.6/locale.py
  Symlinking mysite-env/lib/python2.6/encodings
  Symlinking mysite-env/lib/python2.6/codecs.py
  Symlinking mysite-env/lib/python2.6/stat.py
  Symlinking mysite-env/lib/python2.6/UserDict.py
  Symlinking mysite-env/lib/python2.6/lib-dynload/readline.so
  Symlinking failed, copying to mysite-env/lib/python2.6/lib-dynload/readline.so
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 9, in <module>
    load_entry_point('virtualenv==1.6.1', 'console_scripts', 'virtualenv')()
  File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 795, in main
    never_download=options.never_download)
  File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 886, in create_environment
    site_packages=site_packages, clear=clear))
  File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 1020, in install_python
    copy_required_modules(home_dir)
  File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 974, in copy_required_modules
    copyfile(filename, dst_filename)
  File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 414, in copyfile
    copyfileordir(src, dest)
  File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 391, in copyfileordir
    shutil.copy2(src, dest)
  File "/usr/lib/python2.6/shutil.py", line 99, in copy2
    copyfile(src, dst)
  File "/usr/lib/python2.6/shutil.py", line 53, in copyfile
    fdst = open(dst, 'wb')
IOError: [Errno 20] Not a directory: 'mysite-env/lib/python2.6/lib-dynload/readline.so'

如果我再次运行它,我会得到以下结果:

Directory mysite-env/lib/python2.6 already exists
Symlinking Python bootstrap modules
  Ignoring built-in bootstrap module: posix
  Cannot import bootstrap module: nt
  Symlinking mysite-env/lib/python2.6/lib-dynload/readline.so
  Symlinking mysite-env/lib/python2.6/copy_reg.py
  Symlinking mysite-env/lib/python2.6/types.py
  Symlinking mysite-env/lib/python2.6/re.py
  Symlinking mysite-env/lib/python2.6/sre.py
  Symlinking mysite-env/lib/python2.6/sre_parse.py
  Symlinking mysite-env/lib/python2.6/sre_constants.py
  Symlinking mysite-env/lib/python2.6/sre_compile.py
  Ignoring built-in bootstrap module: zlib
  Symlinking mysite-env/lib/python2.6/warnings.py
  Symlinking mysite-env/lib/python2.6/linecache.py
  Symlinking mysite-env/lib/python2.6/_abcoll.py
  Symlinking mysite-env/lib/python2.6/abc.py
Creating mysite-env/lib/python2.6/site-packages
Writing mysite-env/lib/python2.6/site.py
Writing mysite-env/lib/python2.6/orig-prefix.txt
Creating parent directories for mysite-env/include
Symlinking mysite-env/include/python2.6
Creating mysite-env/bin
New python executable in mysite-env/bin/python
Changed mode of mysite-env/bin/python to 0755
Testing executable with mysite-env/bin/python -c "import sys; print(sys.prefix)"
ERROR: The executable mysite-env/bin/python is not functioning
ERROR: It thinks sys.prefix is u'/usr' (should be '/vagrant/mysite-env')
ERROR: virtualenv is not compatible with this system or executable

任何想法如何解决这个问题?谢谢!

1 个答案:

答案 0 :(得分:0)

对于遇到同样问题的其他人,我让它运转起来了 - 我最后从干净的图像重新安装了所有东西。