I built Python 3.3.0 from source on my Ubuntu 13.10 laptop.
When using the /usr/bin/virtualenv -p /python3.3.0/bin/python3 foo_virt
command to create a virtual environemnt, I see no modules installed when running pip freeze
, which is the behavior I expect.
When using /python3.3.0/bin/python3 -m venv foo_virt
, I see tons of modules installed:
(foo_virt) user@laptop:/foo_virt$ /usr/bin/pip freeze --local
Jinja2==2.7
Mako==0.8.1
MarkupSafe==0.15
PAM==0.4.2
Pillow==2.0.0
Pygments==1.6
SecretStorage==1.0.0
... (total of 75 modules listed)
I tried then to install pip for that specific version of Python, by running, as per the module's documentation: python3 get-pip.py
. But I still see all these modules:
(foo_virt) user@laptop:/foo_virt$ which pip
/foo_virt/bin/pip
(foo_virt) user@laptop:/foo_virt$ pip freeze --local
Jinja2==2.7
Mako==0.8.1
MarkupSafe==0.15
PAM==0.4.2
Pillow==2.0.0
Pygments==1.6
SecretStorage==1.0.0
... (still 75 modules)
How do I use venv
so no modules are installed in the virtual environment? I didn't find any option in the documentation to help me. Also, this issue is not happening on Windows 7. Thanks!
bash caches commands found by searching the PATH
. You can see the current cache by entering hash
. Adding -r
resets the cache. -d
will delete an individual name. Sourcing the activate script should reset the cache:
# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands. Without forgetting
# past commands the $PATH changes we made may not be respected
if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
hash -r
fi
Maybe you ran the system pip before get-pip.py. In that case hash -d pip
solves the problem.