最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python 3.x - VS Code switching the interpreter from conda to base - Stack Overflow

programmeradmin0浏览0评论

I'm trying to learn to use conda the "right" way. In the past I was creating new virtual environments using the shift+command+p combination and picking the "create environment" (I'm using conda) option. But I started noticing the cons of this method as it is creating venvs without name. I tried to do it normally and met some unpleasant problems...

At the beginning vs code started using double venv (base and one I created) and after I used conda config --set auto_activate_base False it is not appearing. But now it keeps using the base python version, even tho I tried to select my venv interpreter.

It would be awesome if someone could help with it, because I'm basically forced to use this stupid method of creating new venv for each new project (even if it's just to test something).

I tried to use alias but it is temporary solution and it could work only if I try to run code manually. but as long as I want to use vs code to run code it won't work.

Here is the output from the terminal:

python -u "/Users/user/Documents/Coding/Python/test/df_cleaner.py"
(testing_grounds) ... test % python -u "/Users/user/Documents/C
oding/Python/test/df_cleaner.py"
Traceback (most recent call last):
  File "/Users/user/Documents/Coding/Python/test/df_cleaner.py", line 1, in <module>
    import pandas as pd
ModuleNotFoundError: No module named 'pandas'
(testing_grounds) ... test % conda install pandas
Channels:
 - defaults
Platform: osx-arm64
Collecting package metadata (repodata.json): done
Solving environment: done

# All requested packages already installed.

(testing_grounds) ... test % python -u "/Users/user/Documents/C
oding/Python/test/df_cleaner.py"
Traceback (most recent call last):
  File "/Users/user/Documents/Coding/Python/test/df_cleaner.py", line 1, in <module>
    import pandas as pd
ModuleNotFoundError: No module named 'pandas'
(testing_grounds) ... test % 

VS code version: 1.82.2 Python version: (testing grounds) 3.13.2 (base) 3.12.4 OS: MacOS Sequoia

发布评论

评论列表(0)

  1. 暂无评论