Egor
Egor

Reputation: 13

Pip inside virtualenv install packages in the wrong place

So I tried to install flask package inside virtualenv.

$ virtualenv env
Using base prefix '/usr'
New python executable in /home/egor/Documents/python/projects/flask/env/bin/python3
Also creating executable in /home/egor/Documents/python/projects/flask/env/bin/python
Installing setuptools, pip, wheel...done.
$ . ./env/bin/activate
(env) $ sudo pip3 install flask

After this I tried to import flask package in python and got ImportError exception. (env) $ pip3 freeze gave me nothing. Then I've discovered package in /usr/local/lib/python3.5/dist-packages directory.

So basically pip3 inside vurtualenv install packages in the wrong place. How can I solve this problem? Is it because of Using base prefix '/usr' line?

Upvotes: 0

Views: 364

Answers (1)

lwshang
lwshang

Reputation: 91

I believe that pip doesn't need root privilege (especially in a virtual env). Try pip3 install flask without sudo.

Upvotes: 1

Related Questions