python - macOS Conda 环境在 VSCode 中激活但未使用正确版本的 Python 或未找到已安装的包
问题描述
这是我的系统终端的输出,我用于环境的python版本是3.8.11。
(base) user@MacBook-Pro ~ % conda activate EC
(EC) user@MacBook-Pro ~ % python
Python 3.8.11 (default, Aug 6 2021, 08:56:27)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
但是如果我在 VSCode 中选择我的 EC 环境作为 python 解释器,python 的版本是不同的,我的包不存在。
source /Users/user/opt/anaconda3/bin/activate
(base) user@MacBook-Pro Assignment1 % source /Users/user/opt/anaconda3/bin/activate
(base) user@MacBook-Pro Assignment1 % conda activate EC
(EC) user@MacBook-Pro Assignment1 % python
WARNING: Python 2.7 is not recommended.
This version is included in macOS for compatibility with legacy software.
Future versions of macOS will not include Python 2.7.
Instead, it is recommended that you transition to using 'python3' from within Terminal.
Python 2.7.16 (default, Jun 18 2021, 03:23:53)
[GCC Apple LLVM 12.0.5 (clang-1205.0.19.59.6) [+internal-os, ptrauth-isa=deploy on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
在 VSCode 中使用python3
也会加载我无法使用的 3.9。有任何想法吗?
解决方案
推荐阅读
- c# - 仅从 Word 文档中每隔一页打印一次。我怎样才能做到这一点?
- java - 在显示之前获取舞台的大小
- java - Jackson 动态属性名称
- python - 在 GAN 损失函数 (Keras) 中实现统计约束
- c - 使用 C 的 select() 系统调用为 UDP 应用程序创建多个客户端和一个服务器
- aws-lambda - 如何从 Quarkus REST API 中访问 lambda 执行上下文?
- kubernetes - Pod 状态 CrashLoopBackOff
- centos - 如何在 CentOS6 上安装 rabbitmq
- javascript - props 的值与回调函数中发送的值不同
- mysql - 将两个查询结果合并在一个表中但在两列中