virtualenv与此系统或可执行文件不兼容

时间:2014-02-10 19:53:15

标签: python-2.7 ubuntu-12.04

我比较熟悉Linux(Ubuntu)和安装(Python)软件包。我遇到了mkvirtualenv的问题,无法解决它:

~$ mkvirtualenv mysite70
New python executable in mysite70/bin/python
Traceback (most recent call last):
  File "/usr/lib/python2.7/site.py", line 562, in <module>
    main()
  File "/usr/lib/python2.7/site.py", line 544, in main
    known_paths = addusersitepackages(known_paths)
  File "/usr/lib/python2.7/site.py", line 271, in addusersitepackages
    user_site = getusersitepackages()
  File "/usr/lib/python2.7/site.py", line 246, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/usr/lib/python2.7/site.py", line 236, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/usr/lib/python2.7/sysconfig.py", line 577, in get_config_var
    return get_config_vars().get(name)
  File "/usr/lib/python2.7/sysconfig.py", line 476, in get_config_vars
    _init_posix(_CONFIG_VARS)
  File "/usr/lib/python2.7/sysconfig.py", line 355, in _init_posix
    raise IOError(msg)
IOError: invalid Python installation: unable to open /home/sietse/.virtualenvs/mysite70/local/include/python2.7/pyconfig.h (No such file or directory)
ERROR: The executable mysite70/bin/python is not functioning
ERROR: It thinks sys.prefix is u'/home/usr/.virtualenvs' (should be u'/home/usr/.virtualenvs/mysite70')
ERROR: virtualenv is not compatible with this system or executable

我安装错了吗?

3 个答案:

答案 0 :(得分:1)

这可能是您在Linux计算机上当前登录用户的权限错误。

尝试

sudo mkvirtualenv mysite70

这通常会提示输入root用户的密码。

如果这不起作用,您可能需要查看以下文章:

http://noelusion.com/2013/Fixing-the-mysterious-virtualenv-error-IOError-invalid-Python-installation/

但是请注意,该文章是一个相当具体的实例上的黑客。

答案 1 :(得分:1)

我想我搞砸了装置。我重新安装了Ubuntu,virtualenv等。现在工作正常。

答案 2 :(得分:-1)

确保您的用户名包含重音符或特殊字符。如果是,请更改目录创建环境,创建值等于新路径的环境变量WORKON_HOME。例如:C:\ Envs