Jun-18-2023, 05:19 PM
(This post was last modified: Jun-18-2023, 05:20 PM by ao_tex_mal.)
Hi All,
Quick question - not related explicitly to python code - more related to installing packages.
When I try to install packages with pip install - by default it gets installed to Python 3.10 site-packages location as below, notice the
![[Image: 2023-06-18-11-43-30-Settings.png]](https://i.ibb.co/HFr6HT8/2023-06-18-11-43-30-Settings.png)
So first question is - why is that happening and how do I change that behavior? I want pip to install packages to 311 directory by default without having to specify the target every time. I thought the PATH variable being defined and set int he right order should achieve that.
Second question is that if I do force the package to be installed in 3.11 by using
![[Image: 2023-06-18-12-24-09-python-automations-p...o-Code.png]](https://i.ibb.co/7KVb7Hd/2023-06-18-12-24-09-python-automations-py-Desktop-Visual-Studio-Code.png)
I checked the 3.11 site-packages directory to make sure it is installed and it is. Not sure why the code still won't run on 3.11
All help appreciated.
Thanks in advance.
Quick question - not related explicitly to python code - more related to installing packages.
When I try to install packages with pip install - by default it gets installed to Python 3.10 site-packages location as below, notice the
python310
directory.PS C:\Users\abhik\Nextcloud\Python\Desktop> pip install lxml Requirement already satisfied: lxml in c:\users\abhik\appdata\local\programs\python\python310\lib\site-packages (4.9.2)However my default python version is python 311 and the environment variables have 3.11 paths first in order.
PS C:\Users\abhik\Nextcloud\Python\Desktop> py -V Python 3.11.4
![[Image: 2023-06-18-11-43-30-Settings.png]](https://i.ibb.co/HFr6HT8/2023-06-18-11-43-30-Settings.png)
So first question is - why is that happening and how do I change that behavior? I want pip to install packages to 311 directory by default without having to specify the target every time. I thought the PATH variable being defined and set int he right order should achieve that.
Second question is that if I do force the package to be installed in 3.11 by using
py -m pip install
it does work but even after that when I execute the code with 3.11 as the interpreter it produces an error saying the package is not installed. Code works as intended on 3.10.PS C:\Users\abhik\Nextcloud\Python\Desktop> py -m pip install lxml Requirement already satisfied: lxml in c:\users\abhik\appdata\local\programs\python\python311\lib\site-packages (4.9.2)I am using VS Code with Jupyter extensions, here is a sample of the error (not full code).
![[Image: 2023-06-18-12-24-09-python-automations-p...o-Code.png]](https://i.ibb.co/7KVb7Hd/2023-06-18-12-24-09-python-automations-py-Desktop-Visual-Studio-Code.png)
I checked the 3.11 site-packages directory to make sure it is installed and it is. Not sure why the code still won't run on 3.11
All help appreciated.
Thanks in advance.