如果您想了解【Linux】Ubuntu安装anaconda的相关知识,那么本文是一篇不可错过的文章,我们将对ubuntu中安装anaconda进行全面详尽的解释,并且为您提供关于anaconda+te
如果您想了解【Linux】Ubuntu 安装 anaconda的相关知识,那么本文是一篇不可错过的文章,我们将对ubuntu中安装anaconda进行全面详尽的解释,并且为您提供关于anaconda + tensorflow +ubuntu、Anaconda 2020 版本安装在提取文件“anaconda-navigator-1.9.12-py38_0.tar.bz2”时永久挂在 Windows 10 上、anaconda tensorflow tflearn 自动安装脚本 anaconda 使用 - b 可以非交互式安装、anaconda 环境 ---ubuntu 下重装的有价值的信息。
本文目录一览:- 【Linux】Ubuntu 安装 anaconda(ubuntu中安装anaconda)
- anaconda + tensorflow +ubuntu
- Anaconda 2020 版本安装在提取文件“anaconda-navigator-1.9.12-py38_0.tar.bz2”时永久挂在 Windows 10 上
- anaconda tensorflow tflearn 自动安装脚本 anaconda 使用 - b 可以非交互式安装
- anaconda 环境 ---ubuntu 下重装
【Linux】Ubuntu 安装 anaconda(ubuntu中安装anaconda)
配置环境:
Ubuntu 19.4
Anaconda3
网上下载 Linux 版本的安装包,安装 Anaconda
cd Downloads
bash Anaconda3-2019.10-Linux-x86_64.sh
之后会出现欢迎信息,告诉你要阅读的许可文件,一路回车遇到 yes 输入 yes 继续安装
安装过程执行完成以后关闭终端,重新打开,在终端输入 python ,如果出现了 Anaconda 的信息,说明安装成功了
创建 Anaconda-nacigator 快捷方式
在 /usr/share/applications 创建文件:anaconda.desktop
cd /usr/share/applications
sudo gedit anaconda.desktop
编辑这个文件,添加一下内容,保存退出
[Desktop Entry]
Name=Anaconda
Version=1.0
Type=Application
Exec=anaconda3/bin/anaconda-navigator
Icon=anaconda3/pkgs/anaconda-navigator-1.9.7-py37_0/lib/python3.7/site-packages/anaconda_navigator/static/images/anaconda-icon-256x256.png
Terminal=false
StartupNotify=true
注意,我的安装位置为:~/annaconda3 但是不能这样写,要写成 /anaconda3
如果不知道 Icon 位置,可以根据下面这条命令在 annaconda3 文件夹下查找具体路径
find -name ''ana*.png''
然后在我们的主菜单里就有快捷方式了
anaconda + tensorflow +ubuntu
用过一段时间的caffe后,对caffe有两点感受:1、速度确实快; 2、 太不灵活了。
深度学习技术一直在发展,但是caffe的更新跟不上进度,也许是维护团队的关系:CAFFE团队成员都是业余时间在维护和更新。导致的结果就是很多新的技术在caffe里用不了,比如RNN,LSTM,batch-norm等。当然这些现在也算是旧的东西了,也许caffe已经有了,我已经很久没有关注caffe的新版本了。它的不灵活之处就是新的东西很难自己扩展,只能等版本更新,这就比较尴尬。
因此,只学caffe一个工具看来是不行了,还得学习其它工具。该学什么呢?当然是如日中天的tensorflow了,毕竟它背后的团队很强大,功能也比较齐全,更新也很及时。所谓技多不压身,学了caffe后再学tensorflow,两者结合着用。
关于tensorflow的介绍,此处不再啰嗦。关于gpu的安装与配置,此处也不涉及。
一、安装anaconda
tensorflow是基于python脚本语言的,因此需要安装python,当然还需要安装numpy、scipy、six、matplotlib等几十个扩展包。如果一个个安装,装到啥时候去?(我曾经光安装scipy就装了一天。。。)
不过现在有了集成环境anaconda,安装就方便了。python的大部分扩展包,都集成在anaconda里面了,因此只需要装这一个东西就行了。
先到https://www.continuum.io/downloads下载anaconda,现在的版本有python2.7版本和python3.5版本,下载好对应版本、对应系统的anaconda,它实际上是一个sh脚本文件,大约300M-400M左右。推荐使用linux版的python 2.7版本,因为tensorflow中的有些东西不支持python3.5(如cPickle)。
下载成功后,在终端执行(2.7版本):
# bash Anaconda2-4.1.1-Linux-x86_64.sh
或者3.5 版本:
# bash Anaconda3-4.1.1-Linux-x86_64.sh
在安装的过程中,会问你安装路径,直接回车默认就可以了。有个地方问你是否将anaconda安装路径加入到环境变量(.bashrc)中,这个一定要输入yes
安装成功后,会有当前用户根目录下生成一个anaconda2的文件夹,里面就是安装好的内容。在终端可以输入
conda info 来查询安装信息
输入conda list 可以查询你现在安装了哪些库,常用的python,numpy,scipy名列其中。如果你还有什么包没有安装上,可以运行
conda install *** 来进行安装(***代表包名称),如果某个包版本不是最新的,运行 conda update *** 就可以了。
二、安装tensorflow
先在终端执行:
anaconda search -t conda tensorflow
搜索一下有哪些tensorflow安装包,通过查看版本,选择最高的版本安装。比如我看到是0.10.0rc0版本是最高的,如下图:
因此,执行下面代码来查看详细信息:
anaconda show jjhelmus/tensorflow
它就会告诉你,怎么来安装这个包,在终端执行:
conda install --channel https://conda.anaconda.org/jjhelmus tensorflow
然后输入"y",进行安装。
三、调试
安装成功与否,我们可以测试一下。
在终端输入python,进入python编译环境,然后输入:
import tensorflow as tf
引包tensorflow包,如果没有报错,则安装成功,否则就有问题。
然后可以输入
tf.__version__ tf.__path__
查看tensorflow的安装版本和安装路径(左右各两根下横线)。
Anaconda 2020 版本安装在提取文件“anaconda-navigator-1.9.12-py38_0.tar.bz2”时永久挂在 Windows 10 上
如何解决Anaconda 2020 版本安装在提取文件“anaconda-navigator-1.9.12-py38_0.tar.bz2”时永久挂在 Windows 10 上?
在提取文件“anaconda-navigator-1.9.12-py38_0.tar.bz2”时,所有 Anaconda 2020 版本(2020.11 和 2020.07)安装都挂在 Windows 10 上。即使等待了 10 个小时,它也没有完成。
2019 年的 anaconda 没有出现这个问题,而是它的旧 python 版本。需要帮助。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
anaconda tensorflow tflearn 自动安装脚本 anaconda 使用 - b 可以非交互式安装
install_dir=/usr/local/anaconda3
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # script dir
bash $DIR/Anaconda3-5.0.1-Linux-x86_64.sh -b -p $install_dir
$install_dir/bin/conda install --use-local $DIR/mock-2.0.0-py36_0.tar.bz2
$install_dir/bin/conda install --use-local $DIR/pbr-3.1.1-py36_0.tar.bz2
$install_dir/bin/conda install --use-local $DIR/protobuf-3.5.1-py36_3.tar.bz2
$install_dir/bin/conda install --use-local $DIR/tensorflow-1.4.0-py36_0.tar.bz2
$install_dir/bin/conda install --use-local $DIR/tflearn-0.3.2-py36_0.tar.bz2
export LD_LIBRARY_PATH=$install_dir/lib/:$LD_LIBRARY_PATH
export PATH=$install_dir/bin:$PATH
# test if all python lib install correctly
$install_dir/bin/python -c "import tensorflow"
if [[ $? == "0" ]]; then
echo "tensorflow install successfully!"
else
echo "tensorflow install failed!"
exit 1
fi
$install_dir/bin/python -c "import tflearn"
if [[ $? == "0" ]]; then
echo "tflearn install successfully!"
else
echo "tflearn install failed!"
exit 1
fi# add to source env file
env_file=$DIR//detect_env.sh
echo "#!/usr/bin/bash" > $env_file
echo "export LD_LIBRARY_PATH=$install_dir/lib/:\$LD_LIBRARY_PATH" >> $env_file
echo "export PATH=$install_dir/bin:\$PATH" >> $env_file
echo "!!!Important!!!"
echo "Please use source $env_file to use tensorflow and tflearn...."
anaconda 环境 ---ubuntu 下重装
anaconda 环境 ---ubuntu 下重装
@wp20190312
为何重装? 配置一个环境,意外发现 conda 命令不好用了,提示 “找不到 conda 模块”,整个 conda 虚拟环境中的工程项目无法使用,网上有说主要是 python 路径的指向调用出现了问题。经过多番尝试仍然未解决问题,所以还是重装一下吧,简单 bao 力。
原来使用的是 anaconda2,这次改用 anaconda3。
(1)卸载原来的 anaconda2:rm -rf /home/wp/anaconda2
(2)安装新的 anaconda3
在网址 https://www.cnblogs.com/gaofighting/p/8799169.html 中下载 anaconda3
wp@wp-MS-7519:~/Anaconda3$ sudo sh Anaconda3-2018.12-Linux-x86_64.sh #安装完后带锁
sh Anaconda3-2018.12-Linux-x86_64.sh #安装完后不带锁
======================= 安装过程部分展示 ================================
一直 enter 到选择 yes?
Anaconda3 will now be installed into this location:
/home/wp/anaconda3
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
[/home/wp/anaconda3] >>>
PREFIX=/home/wp/anaconda3
# 安装根据机器性能,通常需要持续几分钟。
Do you wish the installer to initialize Anaconda3
in your /home/wp/.bashrc ? [yes|no]
[no] >>>
You may wish to edit your /home/wp/.bashrc to setup Anaconda3:
source /home/wp/anaconda3/etc/profile.d/conda.sh
Thank you for installing Anaconda3!
====================================================================
To install Visual Studio Code, you will need:
- Administrator Privileges
- Internet connectivity
Visual Studio Code License: https://code.visualstudio.com/license
Do you wish to proceed with the installation of Microsoft VSCode? [yes|no]
>>> yes
Proceeding with installation of Microsoft VSCode
VSCode is already installed!
到此 Anaconda3 安装成功。 重启终端,即可使用 Anaconda3
假如,Anaconda3未安装成功,可以执行: rm -rf ~/anaconda3
,找到Anaconda3的安装路径,卸载后重新安装即可。
===============================================================
(3)在终端,查看当前电脑的 python 版本:
wp@wp-MS-7519:~/anaconda3$ python
Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
wp@wp-MS-7519:~/anaconda3$ python3
Python 3.6.5 (default, Apr 1 2018, 05:46:30)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
我们可以看到,若在终端输入 python,仍然会显示 Ubuntu 自带的 python 版本。
(4)所以如果想用 anaconda,则需要修改终端的默认 python 为 anaconda,执行:
wp@wp-MS-7519:~/anaconda3$ gedit ~/.bashrc
在文件后面添加:export PATH="/home/wp/anaconda3/bin:$PATH" #并保存
wp@wp-MS-7519:~/anaconda3$ source ~/.bashrc #使用修改的路径生效
【export PATH=/home/wp/anaconda2/bin:$PATH
gedit ~/.bashrc
source ~/.bashrc】
(5)再次,查看当前电脑的 python 版本:
wp@wp-MS-7519:~/anaconda3$ python -V
Python 3.7.1 #anaconda3 安装的 python 版本
wp@wp-MS-7519:~/anaconda3$ python
Python 3.7.1 (default, Dec 14 2018, 19:28:38)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
wp@wp-MS-7519:~/anaconda3$ python2
Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
(6)根据工作要求,增加虚拟环境。
6.1 查找可用版本:conda search "^python$"
wp@wp-MS-7519:~/anaconda3$ conda search "^python$"
Loading channels: done
# Name Version Build Channel
python 1.0.1 0 anaconda/cloud/conda-forge
python 1.0.1 0 anaconda/pkgs/free
........
python 2.7.3 2 anaconda/pkgs/free
python 2.7.3 3 anaconda/pkgs/free
python 2.7.3 4 anaconda/pkgs/free
python 2.7.3 5 anaconda/pkgs/free
......................
python 2.7.15 0 anaconda/cloud/conda-forge
python 2.7.15 h1571d57_0 anaconda/pkgs/main
python 2.7.15 h33da82c_1 anaconda/cloud/conda-forge
python 2.7.15 h33da82c_3 anaconda/cloud/conda-forge
python 2.7.15 h33da82c_4 anaconda/cloud/conda-forge
...
python 2.7.15 h9bab390_2 anaconda/pkgs/main
python 2.7.15 h9bab390_4 anaconda/pkgs/main
python 2.7.15 h9bab390_6 anaconda/pkgs/main
python 2.7.15 h9fef7bc_0 anaconda/cloud/conda-forge
................................
python 3.5.0 0 anaconda/pkgs/free
python 3.5.0 1 anaconda/pkgs/free
python 3.5.1 0 anaconda/cloud/conda-forge
python 3.5.1 0 anaconda/pkgs/free
python 3.5.1 1 anaconda/cloud/conda-forge
python 3.5.1 5 anaconda/pkgs/free
python 3.5.2 0 anaconda/cloud/conda-forge
python 3.5.2 0 anaconda/pkgs/free
python 3.5.2 1 anaconda/cloud/conda-forge
...
python 3.5.5 hc3d631a_0 anaconda/pkgs/main
python 3.5.5 hc3d631a_1 anaconda/pkgs/main
python 3.5.5 hc3d631a_3 anaconda/pkgs/main
python 3.5.5 hc3d631a_4 anaconda/pkgs/main
python 3.5.6 hc3d631a_0 anaconda/pkgs/main
python 3.6.0a3 0 anaconda/cloud/conda-forge
............................
python 3.6.7 hd21baee_1002 anaconda/cloud/conda-forge
python 3.6.8 h0371630_0 anaconda/pkgs/main
python 3.7.0 h5001a0f_0 anaconda/cloud/conda-forge
python 3.7.0 h5001a0f_1 anaconda/cloud/conda-forge
python 3.7.0 h5001a0f_4 anaconda/cloud/conda-forge
python 3.7.0 h5001a0f_6 anaconda/cloud/conda-forge
python 3.7.0 h6e4f718_3 anaconda/pkgs/main
...
python 3.7.1 h0371630_7 anaconda/pkgs/main
python 3.7.1 h381d211_1002 anaconda/cloud/conda-forge
python 3.7.1 h5001a0f_0 anaconda/cloud/conda-forge
python 3.7.1 hd21baee_1000 anaconda/cloud/conda-forge
python 3.7.1 hd21baee_1001 anaconda/cloud/conda-forge
python 3.7.2 h0371630_0 anaconda/pkgs/main
6.2 下载的 TensorFlow 对应的 Python 版本一定要和 conda create -n tensorflow python=x.x 的版本一样才行。
考虑,环境没破坏之前,FaceNet 使用的环境:Ubuntu 18.04 + Tensorflow 1.5.0 + Python 2.7 + OpenCV 3.2.0,
A1,这里,装一个 Python 2.7,配一个 Tensorflow 1.5.0 环境。
wp@wp-MS-7519:~/anaconda3$ conda create -n test_py2 python=2
wp@wp-MS-7519:~/anaconda3$ source activate test_py2
wp@wp-MS-7519:~/anaconda3$ python #查看是 python2.7.15
wp@wp-MS-7519:~/anaconda3$ pip install tensorflow
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won''t be maintained after that date. A future version of pip will drop support for Python 2.7.
Looking in indexes: http://pypi.douban.com/simple
Collecting tensorflow
Downloading http://pypi.doubanio.com/packages/d2/ea/ab2c8c0e81bd051cc1180b104c75a865ab0fc66c89be992c4b20bbf6d624/tensorflow-1.13.1-cp27-cp27mu-manylinux1_x86_64.whl (92.5MB)
B1,安装完成后,python ,import tensorflow as tf, 报错
>>> import tensorflow as tf
2019-03-11 16:39:04.749263: F tensorflow/core/platform/cpu_feature_guard.cc:37] The TensorFlow library was compiled to use SSE4.2 instructions, but these aren''t available on your machine.
已放弃 (核心已转储)
解决办法:安装 bazel,编译 tensorflow。这个问题的原因是 CPU 支持更快的运算,安装的 Tensorflow 中缺少对应的模块,需要编译安装。当我们使用 GPU 的情况下,并不需要用到 CPU,所以这些 warning 可以忽略。 安装 bazel 太麻烦了,换思路解决 “安装 tf”。
C1,卸载 tensorflow:(test_py2) wp@wp-MS-7519:~/anaconda3$ pip uninstall tensorflow
D1,重新安装 tensorflow:sudo pip install --ignore-installed --upgrade https://mirrors.tuna.tsinghua.edu.cn/tensorflow/linux/cpu/tensorflow-1.5.0-cp27-none-linux_x86_64.whl
这里说明一下:这一步安装之后,python2 下面 import tensorflow as tf 还是报错,但是在 python3 下面 import tensorflow as tf 不报错。所以,换思路。
A2,换思路,装一个 Python 3.5,配一个 Tensorflow 1.5.0 环境。【刚开始装的是 Python 3.6 和 Tensorflow 1.5.0 最后不好用,经过折腾换 Python 3.5 好用。】
wp@wp-MS-7519:~/anaconda3$ conda create -n test_py3 python=3.6
wp@wp-MS-7519:~/anaconda3$ source activate test_py3
(test_py3) wp@wp-MS-7519:~/anaconda3$ cd test_py3
(test_py3) wp@wp-MS-7519:~/anaconda3/test_py3$ cd tf
(test_py3) wp@wp-MS-7519:~/anaconda3/test_py3/tf$ python
Python 3.6.7 | packaged by conda-forge | (default, Feb 28 2019, 09:07:38)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
安装 tf:sudo pip install --ignore-installed --upgrade https://mirrors.tuna.tsinghua.edu.cn/tensorflow/linux/cpu/tensorflow-1.5.0rc0-cp36-cp36m-linux_x86_64.whl
安装 tf 报错:tensorflow-1.5.0rc0-cp36-cp36m-linux_x86_64.whl is not a supported wheel on this platform.
退出虚拟环境,并卸载 python3.6, 重装 python3.5
(test_py3) wp@wp-MS-7519:~/anaconda3/test_py3/tf$ source deactivate (conda deactivate) #退出虚拟环境
wp@wp-MS-7519:~/anaconda3/test_py3/tf$ conda remove --name test_py3 --all #卸载 python3.6
wp@wp-MS-7519:~/anaconda3/test_py3/tf$ conda create -n test_py3 python=3.5 #重装 python3.5
(test_py3) wp@wp-MS-7519:~/anaconda3/test_py3/tf$ conda activate test_py3
(test_py3) wp@wp-MS-7519:~/anaconda3/test_py3/tf$ pip install --ignore-installed --upgrade tensorflow-1.5.0-cp35-cp35m-linux_x86_64.whl
【安装下载镜像网址 https://mirrors.tuna.tsinghua.edu.cn/tensorflow/linux/cpu/】
(test_py3) wp@wp-MS-7519:~/anaconda3/test_py3/tf$ python
Python 3.5.5 | packaged by conda-forge | (default, Jul 23 2018, 23:45:43)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> tf.__version__
''1.5.0''
>>>
提示,这里需要 py 和 tf 版本相匹配,所以可能会出现反复的:
(1)安装 conda create -n test_py3 python=3.5 与卸载 conda remove --name test_py3 --all ,
(2)安装 pip install --ignore-installed --upgrade tf_setup_name 与卸载 pip uninstall tensorflow 。
【
总结说明:
安装可用环境:conda create --name my_env python=3
删除环境变量:conda remove --name my_env --all
激活新环境:source activate my_env
停用环境:source deactivate
安装可用环境 python3.5 版本:conda create -n my_env35 python=3.5
删除可用环境 python3.5 版本:conda remove --name my_env35 --all
激活新环境:source activate my_env
停用:source deactivate
更新版本:conda update python=3.5.2
查看所有环境:conda info --envs
给环境安装其他软件包:conda install --name my_env35 numpy
更新 anaconda:conda update conda
卸载 Anaconda:conda install anaconda-clean --yes
rm -rf ~/anaconda3
vim ~/.bashrc
更换仓库镜像
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
】
今天的关于【Linux】Ubuntu 安装 anaconda和ubuntu中安装anaconda的分享已经结束,谢谢您的关注,如果想了解更多关于anaconda + tensorflow +ubuntu、Anaconda 2020 版本安装在提取文件“anaconda-navigator-1.9.12-py38_0.tar.bz2”时永久挂在 Windows 10 上、anaconda tensorflow tflearn 自动安装脚本 anaconda 使用 - b 可以非交互式安装、anaconda 环境 ---ubuntu 下重装的相关知识,请在本站进行查询。
本文标签: