Reputation: 475
I have created the virtual env. I am able to see the list of packages installed using the following command
pip freeze > my-awesome-env-req.txt
Now, I want to upgrade a particular package in virtual environment. I ran the following command after successfully activating my virtual env.
pip install upgrade sqlalchemy
The package is upgraded both in the global and virtual environment.
I want the package to be upgraded for virtual environment only.
Upvotes: 3
Views: 12101
Reputation: 89
You should ensure that you're using the virtual environment's Python binary. For example, if you're in the root directory of the venv, you can run
./bin/python3.9 -m pip install --upgrade sqlalchemy
to upgrade the sqlalchemy
package in the venv. Otherwise, running the pip
or python3.*
command could use the system-wide binary (depending on how your $PATH
and shell aliases are set up).
Upvotes: 1
Reputation: 39
You need to create the virtual environment with a new installation of Python and pip. eg:
conda create -n myVirtualEnv python pip
source activate myVirtualEnv
pip install upgrade sqlalchemy
Ran into the same problem with seaborn...
Upvotes: 0
Reputation: 10862
you need to execute the pip command from within the Activated Virtual env..
Upvotes: 1