简体   繁体   中英

Once a Python upgraded to a new version how do you change the path where to Pip install installs?

I've installed a newer version of Python under wsl2 using:

pyenv install 3.9.6 pyenv global 3.9.6

Before I was using 3.8

When I pip install it still looks in the previous pip path related to Python 3.8.5. for already installed packages:

/home/ludo915/.local/lib/python3.8/site-packages

How do I update the path to where pip install installs packages and what exactly am I supposed to set it to?

Ludo

How do I update the path to where pip install installs packages

Is the wrong question. There should be one installation of pip for each python installation that you have. Invoking the correct pip for the corresponding python version will automatically install to the correct site-packages directory.

I am not too familiar with pyenv, but a fail proof advice is to invoke pip using your python interpreter like

python -m pip install

You can replace python with the interpreter that you want to use specifically. If python --version already shows that it points to 3.9, then you should be good to go. Otherwise, you might need to do python3.9 -m pip install

You can either install it using the below command:

python3.9 -m pip install package-name which will be integrated with python3.9

or

If you want to modify the existing default path, then please refer to the below link.

How to change pip installation path

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM