Why do I need to use pip3 but not pip

Arup Rakshit ar at zeit.io
Sat Mar 30 06:27:55 EDT 2019


Hi Peter,

This is awesome. Now where should I put my source code? I see many folders into it.


Thanks,

Arup Rakshit
ar at zeit.io



> On 30-Mar-2019, at 3:26 PM, Peter Otten <__peter__ at web.de> wrote:
> 
> 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
> Downloading/unpacking example
>  Downloading example-0.1.0.tar.gz
>  Running setup.py (path:/home/petto/foo/build/example/setup.py) egg_info 
> for package example
> 
> Downloading/unpacking six (from example)
>  Downloading six-1.12.0-py2.py3-none-any.whl
> Installing collected packages: example, six
>  Running setup.py install for example
> 
> Successfully installed example six
> Cleaning up...
> (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
> 
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list