如何在 ubuntu 18.04 上为已安装的 python 3.8.1 安装 numpy

how to install numpy for already installed python 3.8.1 on ubuntu 18.04

我有 python 2.7、3.6 和 3.8 三个版本。 我在 3.8 上安装了 "numpy" 很多次,但在 jupyter notebook 上不起作用。 任何事情都会有很大的帮助,因为我今晚有任务要提交

linux commands 
> sudo apt update
> sudo -H pip3 install --upgrade pip
> sudo -H pip3 install virtualenv
> mkdir ~/my_project_dir
> cd ~/my_project_dir

and here i ran a single command to install jupyter notebook , which i forgot but it was suggested to me by the terminal

我同意@8hubham - 从 here 下载并安装 anaconda。

然后在您的终端中,您可以创建一个虚拟环境,您可以在其中选择您的特定版本 python (3.8):

conda create --name myenv python=3.8

然后激活虚拟环境:

conda activate myenv

你现在可以 pip install numpy:

pip install numpy

现在使用 pip install ipykerneljupyter:

pip install ipykernel
pip install jupyter

最后,为您的虚拟环境安装内核:

python -m ipykernel install --user --name myenv

当您在刚刚设置的虚拟环境中从您的终端启动 Jupyter 笔记本服务器时 ("myenv"),您应该在设置新的 myenv 下拉菜单中看到您的内核笔记本:

带有 myenv 内核的 jupyter 笔记本服务器新笔记本: