[英]OError: [Errno 26] Text file busy: '/…myvirtualenv/bin/python'
I try to recreate the virtualenv:我尝试重新创建 virtualenv:
foo_bar_d@aptguettler:~$ virtualenv --system-site-packages .
I get this exception:我得到这个例外:
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 works (afaik) by modifying a copy of the python executable in the virtualenv directory area. virtualenv 通过修改 virtualenv 目录区域中的 python 可执行文件的副本来工作(afaik)。
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 的进程,因此 python 可执行文件的副本“正在使用”(从技术上讲,它在执行时将 mmap() 放入内存中)。
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.除非您需要更改 virtualenv 的设置,否则您不需要每次都重新运行 virtualenv 命令 - 一旦设置好,您只需在需要时激活它。
As to why it happens - It's possible that you have a service running at boot time:至于为什么会发生 - 您可能在启动时运行了一项服务:
ps -ef | grep python
Kill Python Processes running on your system with pkill python
使用
pkill python
杀死系统上运行的 Python 进程
I will work我会工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.