OError: [Errno 26] Text file busy: '/...myvirtualenv/bin/python'

I am trying to recreate 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 anyone know why this exception occurs?

+5
source share
1 answer

I had the same problem :)

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

You must have a process using virtualenv, so a copy of the python executable is "used" (technically this is mmap () "in memory at run time).

If you do not need to change the virtualenv configuration, you do not need to re-run the virtualenv command each time - after you configure it, simply activate it when necessary.

How does this happen? Perhaps you have a service running at boot time:

 ps -ef | grep python 
+8
source

Source: https://habr.com/ru/post/1259225/


All Articles