Virtualenv does not copy standard modules such as shutil and urllib2

When I create a new virtualenv, virtualenv .virtualenvs/my_envthere is only a subset of the standard python modules copied / linked to the new virtualenv.

For example, when I do ls -lin .virtualenvs / my_env / lib / python2.6, I see:

...
... os.py -> /usr/lib/python2.6/os.py
... os.pyc -> /usr/lib/python2.6/os.pyc

but modules like shutiland urllib2are not copied, even if they are in /usr/lib/python2.6/shutil.py. I am using Ubuntu 9.10.

Is this the expected behavior? How can I install modules like shutil in virtualenv (I could not find these modules on pypi)?

+3
source share
1 answer

virtualenv munges sys.path, , , .

, , do:

>>> import os
>>> os
<module 'posixpath' from '/environments/userpython/lib/python2.6/posixpath.pyc'>
>>> import shutil
>>> shutil
<module 'shutil' from '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/shutil.pyc'>

os - , shutil Python.

+6

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


All Articles