- Я создал новый проект Python с pixi venv < /strong>.
У меня есть изолированный Venv, включая Python.
я установил Pandas < /code> и т. Д.
i не Dint < /strong> plotly < /code> и т. Д. < /p>
< /li>
У меня установлен Python.
Установленная среда python .
- Теперь я открываю проект в vscode
/> Если я попытаюсь импортировать plotly < /code>.
It не покажет никакой ошибки < /strong>.
Если я щелкну в него, это переходит к глобальному python env-packages < /strong>. < /p>
< /li>
Даже если я попытаюсь импортировать панд < /code>.
то же самое происходит. -
- Я хочу, чтобы vscode действительно изолировать < /strong> venv.
Stop < /strong> It It Itmostring из Global> Global < /strong> Python Site-Packages.
просто покажите ошибку < /strong>, если это происходит в моем коде.
i cant. < /li>
< /ul>
попытки < /h3>
Я пытался с pythonnesersite = 1 < /code> не работает. Достаточно) < /li>
< /ul>
< /li>
include-system-site-packages = false не существует для Pixi.
compare
- Если я создаю проект с .venv , нет такой проблемы , его действительно изолированное, и vscode . Env Site-Packages или нет).
- Если я создаю проект с .conda , у некоторых проектов нет такой проблемы, (базовая env), но другие, кажется, имеют одинаковую проблему
- Если я создаю проект с .pixi , есть проблема
import os
# Print the executable python thinks it's running
print("--- Python Executable ---")
print(sys.executable)
print("-" * 25)
# Print all the paths python will search for modules
print("\n--- Module Search Paths (sys.path) ---")
for path in sys.path:
print(path)
print("-" * 25)
# Check if the PYTHONPATH variable is set
print("\n--- PYTHONPATH Environment Variable ---")
py_path = os.environ.get('PYTHONPATH')
if py_path:
print(py_path.replace(':', '\n')) # Use ';' for Windows if needed
else:
print("PYTHONPATH is not set.")
print("-" * 25)
# Try the import and see where it comes from
try:
import pandas
print("\n--- 'pandas' was found here: ---")
print(pandas.__file__)
except ImportError:
print("\n--- 'pandas' could not be imported. ---")
try:
import plotly
print("\n--- 'plotly' was found here: ---")
print(plotly.__file__)
except ImportError:
print("\n--- 'plotly' could not be imported. ---")
try:
import torch
print("\n--- 'torch' was found here: ---")
print(torch.__file__)
except ImportError:
print("\n--- 'torch' could not be imported. ---")
< /code>
output: < /p>
D:\usp\uhpsj\study\build_llm_wsp\build_llm>D:/usp/uhpsj/study/build_llm_wsp/build_llm/.pixi/envs/default/python.exe d:/usp/uhpsj/study/build_llm_wsp/build_llm/src/build_llm_demo/_demo/d2.py
--- Python Executable ---
D:\usp\uhpsj\study\build_llm_wsp\build_llm\.pixi\envs\default\python.exe
-------------------------
--- Module Search Paths (sys.path) ---
d:\usp\uhpsj\study\build_llm_wsp\build_llm\src\build_llm_demo\_demo
D:\usp\uhpsj\study\build_llm_wsp\build_llm\.pixi\envs\default\python311.zip
D:\usp\uhpsj\study\build_llm_wsp\build_llm\.pixi\envs\default\DLLs
D:\usp\uhpsj\study\build_llm_wsp\build_llm\.pixi\envs\default\Lib
D:\usp\uhpsj\study\build_llm_wsp\build_llm\.pixi\envs\default
C:\Users\nshln\AppData\Roaming\Python\Python311\site-packages
D:\usp\uhpsj\study\build_llm_wsp\build_llm\.pixi\envs\default\Lib\site-packages
D:\usp\uhpsj\study\build_llm_wsp\build_llm\.pixi\envs\default\Lib\site-packages\win32
D:\usp\uhpsj\study\build_llm_wsp\build_llm\.pixi\envs\default\Lib\site-packages\win32\lib
D:\usp\uhpsj\study\build_llm_wsp\build_llm\.pixi\envs\default\Lib\site-packages\Pythonwin
-------------------------
--- PYTHONPATH Environment Variable ---
PYTHONPATH is not set.
-------------------------
--- 'pandas' was found here: ---
C:\Users\nshln\AppData\Roaming\Python\Python311\site-packages\pandas\__init__.py
--- 'plotly' was found here: ---
C:\Users\nshln\AppData\Roaming\Python\Python311\site-packages\plotly\__init__.py
--- 'torch' was found here: ---
C:\Users\nshln\AppData\Roaming\Python\Python311\site-packages\torch\__init__.py
< /code>
pixi.toml Пакеты
[workspace]
authors = ["norlz "]
channels = ["conda-forge"]
name = "build-llm-demo"
platforms = ["win-64"]
version = "0.1.0"
[tasks]
[system-requirements]
cuda = "12.0"
[dependencies]
python = "3.11.*"
pandas = "=2.9.1,=0.12.0,=1.1.402,=8.4.1,=0.115.13, =0.34.3, =23.0.0,
Подробнее здесь: https://stackoverflow.com/questions/796 ... when-using