简体   繁体   English

在 Google Cloud VM 中找不到 Conda 命令

[英]Conda command not found in Google Cloud VM

I have a problem with Anaconda3 in Google Cloud VM with Ubuntu.我在使用 Ubuntu 的 Google Cloud VM 中使用 Anaconda3 时遇到问题。 I installed Anaconda3 successfully, but I cannot call conda.我成功安装了 Anaconda3,但无法调用 conda。 Here is code from my terminal.这是来自我的终端的代码。

eko_rudiawan@google-ubuntu:~$ $PATH
-bash: /home/eko_rudiawan/bin:/home/eko_rudiawan/.local/bin:/opt/ros/kinetic/bin:/usr/local/sbin:/usr/local/bin:/us
r/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin: No such file or directory
eko_rudiawan@google-ubuntu:~$ which python
/usr/bin/python
eko_rudiawan@google-ubuntu:~$ export PATH="/home/eko_rudiawan/anaconda3/bin:$PATH"
eko_rudiawan@google-ubuntu:~$ which python
/home/eko_rudiawan/anaconda3/bin/python
eko_rudiawan@google-ubuntu:~$ conda --version
conda: command not found
eko_rudiawan@google-ubuntu:~$

My suggestion is to start from the begging.我的建议是从乞讨开始。 I had the same issue in my VM and I fixed with these steps:我在我的 VM 中遇到了同样的问题,我通过以下步骤进行了修复:

  1. SSH to you VM from the Google Cloud Console从 Google Cloud Console SSH 到您的 VM
  2. Run $ ls command to see if the anaconda3 directory is there运行$ ls命令查看anaconda3目录是否存在
  3. If it is execute $ rm -rf anaconda3 .如果是执行$ rm -rf anaconda3 This will force to delete the directory and all its data.这将强制删除目录及其所有数据。
  4. After that execute $ exit to exit the VM or close the window to terminate session.之后执行$ exit退出 VM 或关闭窗口终止会话。
  5. SSH to the VM again再次通过 SSH 连接到 VM
  6. Now we will install the anaconda3.现在我们将安装anaconda3。 I will post the commands below but you can refer to this documentation: How To Install Anaconda on Ubuntu 18.04 [Quickstart] .我将在下面发布命令,但您可以参考此文档: 如何在 Ubuntu 18.04 [快速入门] 上安装 Anaconda
  7. Download the Anaconda Bash Script.下载 Anaconda Bash 脚本。 Execute:执行:
$ cd /tmp
$ curl -O https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh
  1. Verify the Data Integrity of the Installer验证安装程序的数据完整性
$ sha256sum Anaconda3-5.2.0-Linux-x86_64.sh

Output
09f53738b0cd3bb96f5b1bac488e5528df9906be2480fe61df40e0e0d19e3d48  Anaconda3-5.2.0-Linux-x86_64.sh
  1. Run the Anaconda Script运行 Anaconda 脚本
$ bash Anaconda3-5.2.0-Linux-x86_64.sh
  1. Pres ENTER .ENTER Keep pressing enter until the first question comes up.一直按回车直到出现第一个问题。
  2. When asked Do you accept the license terms?当被问及您是否接受许可条款时? [yes|no] , type yes hit ENTER . [yes|no] ,输入yes点击ENTER
  3. When asked:当被问到:
Anaconda3 will now be installed into this location:
/home/[YOUR_USERNAME]/anaconda3

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below

[/home/[YOUR_USERNAME]/anaconda3] >>> 
  1. Hit ENTER .ENTER This will take some time and a lot of files will be installed.这将需要一些时间,并且将安装大量文件。
  2. When asked Do you wish the installer to prepend the Anaconda3 install location to PATH in your /home/cusnir/.bashrc ?当被问到您是否希望安装程序在您的 /home/cusnir/.bashrc 中将 Anaconda3 安装位置添加到 PATH 之前? [yes|no] , type yes hit ENTER . [yes|no] ,输入yes点击ENTER
  3. Now you should see: Thank you for installing Anaconda3!现在您应该看到: Thank you for installing Anaconda3!
  4. When asked Do you wish to proceed with the installation of Microsoft VSCode?当询问您是否要继续安装 Microsoft VSCode 时? [yes|no] type no and hit ENTER . [yes|no]输入no并按 ENTER
  5. Go to main directory by executing $ cd通过执行$ cd转到主目录
  6. If you execute $ ls .如果执行$ ls You should see the anaconda3 directory there.您应该在那里看到anaconda3目录。
  7. You can activate the anaconda environment by executing: $ source anaconda3/bin/activate您可以通过执行: $ source anaconda3/bin/activate来激活 anaconda 环境
  8. Now you should see (base) [YOUR_USERNAME]@ubuntu-linux-os:~$ .现在你应该看到(base) [YOUR_USERNAME]@ubuntu-linux-os:~$ Which (base) means you are inside that environment.其中(基础)意味着您在该环境中。
  9. Execute: $ conda --version执行: $ conda --version
  10. You should get conda 4.5.4 response.你应该得到conda 4.5.4响应。
  11. However you can also do that without the step 18 .但是,您也可以在没有步骤 18 的情况下执行此操作。 Just when you SSH to the VM execute conda --version and you should see the anaconda's version.就在您通过 SSH 连接到 VM 时执行conda --version ,您应该会看到 anaconda 的版本。

Old question but I just encountered the same issue.老问题,但我刚刚遇到了同样的问题。 I only needed to do step 19 to get conda to work.我只需要执行第 19 步即可让 conda 工作。 No need to start over.无需重新开始。 However the fix didn't stick - had to repeat on next terminal session.然而,修复没有坚持 - 必须在下一个终端会话中重复。

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

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