Why do I need to use pip3 but not pip
Arup Rakshit wrote:
> Hello All,
> Thanks I got it now.
> One related question: Can I use pip3 for example to install packages
> project specific, but not globally? So that when I delete the project, all
> of them gone also from my disk.
For that you can create a "virtual environment":
$ python3 -m venv foo
$ cd foo
$ . bin/activate
Once you have activated it you can use 'pip' and 'python' to invoke the
versions attached to the virtual environment:
(foo) $ pip install example
Running setup.py (path:/home/petto/foo/build/example/setup.py) egg_info
for package example
Downloading/unpacking six (from example)
Installing collected packages: example, six
Running setup.py install for example
Successfully installed example six
(foo) $ python
Python 3.4.3 (default, Nov 12 2018, 22:25:49)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import example
Let's get rid of it now:
(foo) $ deactivate
$ cd ..
$ rm -r foo # everything should be gone