I’ve read several topics and docs on this subject and could not find an “easy” solution for me as I am quite a beginner with Python.
I created a Python virtual environment through venv (on Windows), because I was facing some problems with “PATH” and pip packages.
My venv is created, activated and configured like this :
(fortiupdate.venv) c:[...]fortiupdate.venvScripts>echo %PATH%
c:[...]fortiupdate.venvScripts;C:Program Files (x86)VMwareVMware vSphere CLIPerlsitebin;
(fortiupdate.venv) c:[...]fortiupdate.venvScripts>where python
c:[...]fortiupdate.venvScriptspython.exe
(fortiupdate.venv) c:[...]fortiupdate.venvScripts>where pip
c:[...]fortiupdate.venvScriptspip.exe
When I install a package with :
pip install django
Download and installation are ok, but “pip list” doesn’t return the package django to be installed/available.
I tried :
(fortiupdate.venv) c:[...]fortiupdate.venvScripts>pip config list
:env:.target='C:\Users\[..]\AppData\Local\Programs\Python\Python312\Scripts'
global.index-url='https://<private_repo>/artifactory/api/pypi/pythonproxy/simple'
I confirm that packages are installed in the “:env:.target” directory, instead of the “.venv/lib/site-packages” directory
It doesn’t really matter to me where packages are installed, if I can use them in my scripts.
But actually, pip installs packages in …/APPData/… but search for them in my .venv directory if I try to list / use them !
How can I resolve this behavior please ?
(I would prefer use the .venv directory for downloaded packages through pip, but if you have a solution for using the packages in /AppData/ when I execute my .py scripts, it would be an acceptable workaround)