如何为makerbot / s3g设置虚拟环境

时间:2014-08-14 09:07:43

标签: python virtualenv

我试图让这个模块正常工作:

https://github.com/makerbot/s3g

他们的命名有点令人困惑,因为整个事情经常被称为" makerbot_driver"并且还有一个名为的子文件夹。

当我尝试运行命令时遇到麻烦:

python virtualenv.py virtualenv

当我尝试在makerbot_driver文件夹中运行它时,正如他们所建议的那样,我明白了:

python: can't open file 'virtualenv.py': [Errno 2] No such file or directory

这是有道理的,因为virtualenv.py实际上是一个文件夹。但是,当我进入一个文件夹并运行相同的命令时,它会有更多的成功,但会遇到一堆我真的无法解释的错误:

New python executable in virtualenv/bin/python
Installing setuptools...................................
  Complete output from command /home/jason/GitHub/s3g/virtualenv/bin/python -c "#!python
\"\"\"Bootstra...sys.argv[1:])






" /home/jason/GitHub/s...ols-0.6c11-py2.7.egg:
  Traceback (most recent call last):
  File "<string>", line 279, in <module>
  File "<string>", line 240, in main
  File "/home/jason/GitHub/s3g/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 1712, in main
  File "/home/jason/GitHub/s3g/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 1700, in with_ei_usage
  File "/home/jason/GitHub/s3g/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 1716, in <lambda>
  File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 971, in run_command
    cmd_obj.ensure_finalized()
  File "/usr/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
    self.finalize_options()
  File "/home/jason/GitHub/s3g/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 125, in finalize_options
  File "/home/jason/GitHub/s3g/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 1121, in _expand
  File "/usr/lib/python2.7/distutils/cmd.py", line 312, in get_finalized_command
    cmd_obj.ensure_finalized()
  File "/usr/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
    self.finalize_options()
  File "/home/jason/GitHub/s3g/setuptools-0.6c11-py2.7.egg/setuptools/command/install.py", line 32, in finalize_options
  File "/usr/lib/python2.7/distutils/command/install.py", line 321, in finalize_options
    (prefix, exec_prefix) = get_config_vars('prefix', 'exec_prefix')
  File "/home/jason/GitHub/s3g/virtualenv/lib/python2.7/distutils/__init__.py", line 88, in sysconfig_get_config_vars
    real_vars = old_get_config_vars(*args)
  File "/usr/lib/python2.7/distutils/sysconfig.py", line 495, in get_config_vars
    func()
  File "/usr/lib/python2.7/distutils/sysconfig.py", line 439, in _init_posix
    from _sysconfigdata import build_time_vars
  File "/usr/lib/python2.7/_sysconfigdata.py", line 6, in <module>
    from _sysconfigdata_nd import *
ImportError: No module named _sysconfigdata_nd
----------------------------------------
...Installing setuptools...done.
Traceback (most recent call last):
  File "virtualenv.py", line 2270, in <module>
    main()
  File "virtualenv.py", line 928, in main
    never_download=options.never_download)
  File "virtualenv.py", line 1040, in create_environment
    search_dirs=search_dirs, never_download=never_download)
  File "virtualenv.py", line 593, in install_setuptools
    search_dirs=search_dirs, never_download=never_download)
  File "virtualenv.py", line 567, in _install_req
    cwd=cwd)
  File "virtualenv.py", line 1006, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /home/jason/GitHub/s3g/virtualenv/bin/python -c "#!python
\"\"\"Bootstra...sys.argv[1:])






" /home/jason/GitHub/s...ols-0.6c11-py2.7.egg failed with error code 1

我试图安装像他们需要的pyserial模块和virtualenv这样的东西,而且事实证明这很好,但这种虚拟的东西对我来说仍然很糟糕。

任何建议都将受到赞赏。感谢。

1 个答案:

答案 0 :(得分:2)

这是Ubuntu中的已知错误。修正:

$ cd /usr/lib/python2.7
$ sudo ln -s plat-x86_64-linux-gnu/_sysconfigdata_nd.py .

然后它有效。

$ python2.7 virtualenv.py virtualenv
New python executable in virtualenv/bin/python2.7
Not overwriting existing python script virtualenv/bin/python (you must use virtualenv/bin/python2.7)
Installing setuptools................................done.
Installing pip.....................done.