I have installed virtualenv using the command pip install virtualenv and it gave me this.
pip install virtualenv
Downloading/unpacking virtualenv
Downloading virtualenv-15.1.0-py2.py3-none-any.whl (1.8MB): 0% Downloading virtualenv-15.1.0-py2.py3-none-any.whl (1.8MB): 0% Downloading virtualenv-15.1.0-py2.py3-none-any.whl (1.8MB): 1.8MB downloaded
Installing collected packages: virtualenv
Successfully installed virtualenv
Cleaning up...
Now you can see that virtualenv is installed to confirm this i have tested like this,
ubuntu@ubuntu ~ which pip
/usr/bin/pip
ubuntu@ubuntu ~ which python
/usr/bin/python
ubuntu@ubuntu ~ which virtualenv
virtualenv not found
✘ ubuntu@ubuntu ~ python --version
Python 2.7.12
ubuntu@ubuntu ~ pip --version
pip 1.5.6 from /usr/lib/python2.7/dist-packages (python 2.7)
Now real problem is that i want to create a virtualenv i have entered command
virtualenv env --no-site-packages and it gave me error.
command not found: virtualenv
Any solutions to this problem.I have also using ubuntu -16 with all updates installed.
1 Answer 1
You should use your system's package manger to install it instead of pip. On Ubuntu, you can run:
apt-get install python-virtualenv
You will then see output from the 'which' command.
answered Dec 18, 2016 at 19:38
diametralpitch
6953 silver badges5 bronze badges
Sign up to request clarification or add additional context in comments.
4 Comments
void
In addition to this correct answer:
/usr/bin/pip could not install virtualenv into system directories because regular user "ubuntu" cannot write into /usr/bin/. Then virtualenv was installed into user install directory, so you can launch it as /home/ubuntu/.local/bin/virtualenv. Optionally, append ~/.local/bin to $PATH.Anthon
This might work but should not be recommended. Installing this way gives you virtualenv 1.11. The current version of virtualenv is 15.1, which has many bug fixes, and works with a more modern versions of
pip for further installs (with their own bug and security fixes). Since you can install virtualenv directly in a virtualenv without needing root prileges, the normal excuse that you should not litter your installation with non-tracked data doesn't hold.diametralpitch
@Anthon it looks like 15.1 is available in the Ubuntu 16 repos packages.ubuntu.com/xenial/python/python-virtualenv
diametralpitch
Correction - 15.0.1
lang-py
virtualenvseems not to be in the load-path. Just reopening the terminal might already help, otherwisepip show virtualenvshows you the location that you can then add to your load-path.ubuntu@ubuntu ~ pip show virtualenv --- Name: virtualenv Version: 15.1.0 Location: /home/ubuntu/.local/lib/python2.7/site-packages Requires: ubuntu@ubuntu ~ virtualenv zsh: command not found: virtualenvecho $PATH?/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/binpipin your Linux systems' python, you might break your system. Apart from that the currentpipversion is 9.0.1, that what you have there is outdated and insecure. See e.g. stackoverflow.com/a/30692103/1307905 on how to properly create and usevirtualenvin a virtual env.