Reputation: 115
When I worked in a virtual environment, I installed my packages django-2.0
there. Yet it is installed globally:
sudo virtualenv -p /usr/bin/python3.5 ~/.virtualenv/venv
source ~/.virtualenv/venv/bin/activate
(venv) $ pip install django==2.0
And I had django-1.11 in my global environment before. However django-1.11 is also hoping to be installed into the other virtual environment, but it was also installed globally. I uninstall this package, and try to install it into my virtual environ again. but it seems like not work at all. All package installed newly were in global env.
Now i want to use pip freeze >requirements.txt
to get requirements file,but it return :
(venv) $ pip3 freeze >requirements.txt
bash: requirements.txt: Permission denied
(venv) $ sudo pip3 freeze >requirements.txt
bash: requirements.txt: Permission denied
I thought maybe it was because that i install these package globally?I don't know.
How can i install package into my virtual environment correctly, and get requirement file:(
Upvotes: 1
Views: 5202
Reputation: 507
It is a mere permission issue: check that requirements doesn't already exists with some permission you don't have. If so, sudo rm requirements.txt
and pip3 freeze > requirements.txt
should do the trick.
Else it should mean you don't have the write permission in the folder you are in. Try sudo chown -R your_username directory_path
Upvotes: 1