简体   繁体   English

Atom 和 anaconda 兼容性问题

[英]Problem with Atom and anaconda compatibility

I am now learning numpy and therefore installed anaconda which comes with many python libraries.我现在正在学习 numpy 并因此安装了 anaconda ,它带有许多 python 库。 I used by now Atom with python.我现在使用 Atom 和 python。

Now I have problems with importing numpy.现在我在导入 numpy 时遇到问题。 It seems as though both Atom and my Mac are using two different python versions似乎 Atom 和我的 Mac 都在使用两个不同的 python 版本

because when i am in the terminal and look up the version of python it gives me back this:因为当我在终端中查找 python 的版本时,它给了我这个:

Python 3.9.7 (default, Sep 16 2021, 08:50:36) [Clang 10.0.0 ]:: Anaconda, Inc. on darwin Type "help", "copyright", "credits" or "license" for more information. Python 3.9.7(默认,2021 年 9 月 16 日,08:50:36)[Clang 10.0.0]:: Anaconda, Inc. on darwin 键入“帮助”、“版权信息”、“信用证” .

However when I am in Atom and type in the terinal there it gives me back this:但是,当我在 Atom 中并在那里输入终端时,它会返回:

Python 2.7.18 Python 2.7.18

I tried to install numpy within Atom with the "pip install numpy" call but it keeps giving me back that I have numpy already:我尝试使用“pip install numpy”调用在 Atom 中安装 numpy,但它一直告诉我我已经有 numpy:

Requirement already satisfied: numpy in /opt/anaconda3/lib/python3.9/site-packages (1.22.0)已满足要求:/opt/anaconda3/lib/python3.9/site-packages (1.22.0) 中的 numpy

I am just desperate and don't know how to make Atom run anaconda I tried several techniques described on stackoverflow with the shell override but nothing did work(with the ways I tried to do it), can anyone help me, please?我很绝望,不知道如何让 Atom 运行 anaconda 我尝试了在 stackoverflow 上描述的几种技术,使用 shell 覆盖,但没有任何效果(我尝试这样做的方式),有人可以帮助我吗?

Since you're on Mac, you need 2.7, but you don't want to run that version in Atom.由于您使用的是 Mac,因此您需要 2.7,但您不想在 Atom 中运行该版本。

Install atom-runner into Atom, if not already installed.如果尚未安装,请将 atom-runner 安装到 Atom 中。 When installed (or if already installed), go to the package and click on view code.安装后(或如果已安装),go 到 package 并单击查看代码。

在此处输入图像描述

在此处输入图像描述

From there, go to the project pane.从那里,go 到项目窗格。 In that pane, open the drop-down for the 'lib' folder and click on 'atom-runner.coffee'在该窗格中,打开“lib”文件夹的下拉菜单,然后单击“atom-runner.coffee”

在此处输入图像描述

Scroll to line 38 - is it python?滚动到第 38 行 - 是 python 吗? Change it to 'python3'.将其更改为“python3”。

在此处输入图像描述

For the most part, you'll use 'python3' anywhere it says to use 'python' in a call in Terminal.在大多数情况下,您将在终端调用中使用“python”的任何地方使用“python3”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM