在 Mac OS X 上安装并运行 Jupyter,遇到的问题

Google官方有安装教程,地址https://developers.google.cn/machine-learning/crash-course/running-exercises-locally#download-exercises,其实,对于我这个初学者来说,难点是在于python开发环境的配置,下面就看看,我遇到的问题,以及最后怎么解决的。我用的是mac

按照教程第二步安装pip和virtualenv

sudo easy_install pip virtualenv

然后第三步,在执行

virtualenv --no-site-package jupyter-env

的时候一直报错,Virtualenv Command Not Found,然后就在网上各种搜索,期间也慢慢了解些pip和virtualenv是干啥的,后来按照网上的教程,用pip把virtualenv又安装了一遍(命令是pip install virtualenv,我也不知道用easy_install命令有没有把virtualenv安装成功,按照查的资料来看,pip是easy_install的升级版,都是安装工具),然后把virtualenv的安装目录配置到了.bash_profile文件中。在bash中输入virtualenv能找到这个命令,心里很高兴,感觉再执行virtualenv --no-site-package jupyter-env一定没问题了,结果还是报错,而且报的错更复杂,报错情况和下面帖子中的一样

Virtualenv OSError - setuptools pip wheel failed with error code 1

也是按照帖子中的方法,采用conda install virtualenv,conda是什么鬼(感觉解决问题中遇到的问题越来越多),查资料,原来是conda是比pip更高级更智能的安装工具,为了使用conda把Anaconda(自行搜索)安装了,安装很智能,安装完环境变量就配置好了,然后再执行conda install virtualenv,virtualenv --no-site-package jupyter-env,virtualenv就正常运行了。

说一些我对Anaconda的理解,Anaconda是一个集成工具,安装完Anaconda,就来了pip、conda等工具,就不用自己安装了啦,在bash(命令行)中输入which pip,发现pip是Anaconda包中的pip,而不是之前通过easy_install pip安装的pip。

到了第四步的b步安装库

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --ignore-installed --upgrade \
  tensorflow "matplotlib<3" pandas sklearn scipy seaborn ipython==5.7 notebook

又遇到了问题:

Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow

先分析以上上面的命令,-i (通过pip install -h 命令查看详细解释)是临时镜像的意思,从地址https://pypi.tuna.tsinghua.edu.cn/simple 下载tensorflow等包,后来在查资料解决了,资料地址:

Could not find a version that satisfies the requirement tensorflow

tensorflow下载后,其他包使用命令pip install "matplotlib<3" pandas sklearn scipy seaborn ipython==5.7 notebook 正常下载就行。

至此,安装过程的所有问题都解决,期间遇到的概念,大家自行搜索了解。

参考资料:

Virtualenv Command Not Found

Virtualenv OSError - setuptools pip wheel failed with error code 1

python easy_install pip 关系

Anaconda完全入门指南

Anaconda详细安装使用教程

virtualenv

pip install 执行过程中遇到的各种问题

Could not find a version that satisfies the requirement tensorflow

猜你喜欢

转载自blog.csdn.net/lizhongyisailang/article/details/86686745