OError: [Errno 26] 文本文件繁忙:'/...myvirtualenv/bin/python' [英] OError: [Errno 26] Text file busy: '/...myvirtualenv/bin/python'

查看:37
本文介绍了OError: [Errno 26] 文本文件繁忙:'/...myvirtualenv/bin/python'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试重新创建 virtualenv:

I try to recreate the virtualenv:

foo_bar_d@aptguettler:~$ virtualenv --system-site-packages . 

我收到此异常:

foo_bar_d@aptguettler:~$ virtualenv --system-site-packages .
New python executable in /home/foo_bar_d/bin/python
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 711, in main
    symlink=options.symlink)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 924, in create_environment
    site_packages=site_packages, clear=clear, symlink=symlink))
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 1230, in install_python
    shutil.copyfile(executable, py_executable)
  File "/usr/lib/python2.7/shutil.py", line 83, in copyfile
    with open(dst, 'wb') as fdst:
IOError: [Errno 26] Text file busy: '/home/foo_bar_d/bin/python'

有人知道为什么会发生这种异常吗?

Does someone know why this exception happens?

推荐答案

我遇到了完全相同的问题 :)

I had the exact same problem :)

virtualenv 通过修改 virtualenv 目录区域中的 python 可执行文件的副本来工作(afaik).

virtualenv works (afaik) by modifying a copy of the python executable in the virtualenv directory area.

您必须已经有一个使用 virtualenv 的进程,以便 python 可执行文件的副本正在使用"(从技术上讲,它在执行时已将 mmap() 放入内存中).

You must have a process using the virtualenv already so the copy of the python executable is 'in use' (technically it's mmap()'ed into memory whilst it's executing).

除非您需要更改 virtualenv 的设置,否则您不需要每次都重新运行 virtualenv 命令 - 一旦设置好,您只需在需要时激活它.

Unless you need to change the setup of a virtualenv you don't need to re-run the virtualenv command every time - once it's setup you just activate it when needed.

至于为什么会发生这种情况 - 您可能在启动时运行了一项服务:

As to why it happens - It's possible that you have a service running at boot time:

ps -ef | grep python

这篇关于OError: [Errno 26] 文本文件繁忙:'/...myvirtualenv/bin/python'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆