Anaconda使用

Ubuntu18.04 安装 Anaconda3

下载地址:清华大学开源软件镜像站

安装 Anaconda

1)打开terminal;

2)打开下载文件的位置:

cd Downloads/

3)运行 .sh 文件:

bash Anaconda3-5.2.0-Linux-x86_64.sh

4)进入注册信息页面,输入yes;

5)阅读注册信息,然后输入yes;查看文件即将安装的位置,按enter,即可安装,如图5;

7)安装完成后,收到加入环境变量的提示信息,输入yes.

8)提示信息“Do you wish to proceed with the installation of Microsoft VSCode? [yes|no]”,输入no;

9)重启终端,即可使用Anaconda3;

10)若在终端输入 python,仍然会显示Ubuntu自带的python版本,我们执行:

    sudo gedit ~/.bashrc
    export PATH="/home/xupp/anaconda3/bin:$PATH"

  修改终端的默认 python 为 anaconda,至此全部完成.

3.验证安装是否成功:

方法一:

启动新终端;查看conda版本:

$ conda --version

如正常显示则证明安装成功;

方法二:

启动新终端;打开Python;

输入import scipy,未报错即已成功。

4.其他拓展

列出安装的包:

$ conda list

更新包:

$ conda update conda

Anaconda文档:https://docs.continuum.io/

 

conda的下载源文件目录

:/home/yourname/.condarc,内容如下:

  • Anaconda修改国内镜像源

  •  

    修改上述配置文件,删除上述配置文件 .condarc 中的第三行,然后保存,最终版本文件如下:

    Anaconda修改国内镜像源

  • 5

    查看是否生效,通过命令 conda info 查看当前配置信息,内容如下,即修改成功,关注 channel URLs 字段内容

    Anaconda修改国内镜像源

  •  

tensorflow版本与python对应关系,可以下载tensorflow:https://pypi.org/project/tensorflow/#files

python查找:conda search python

python安装:conda install python=3.6

tensorflow安装:

(https://pypi.org/project/tensorflow-gpu/2.0.0/#files)

http://mirrors.aliyun.com/pypi/simple/tensorflow-gpu/

需要先创建并激活虚拟环境,再安装. 

(base) zfy@zfy-N9x0TC:~$ conda create -n  tensorflow_python_3_7_4 python=3.7

(base) zfy@zfy-N9x0TC:~$ source activate tensorflow_python_3_7_4

conda install tensorflow-gpu=2.0.0

在anaconda下安装tensorflow-gpu,会默认按张cuda和cudnn,安装2.0.0版本时安装的软件如下:

The following NEW packages will be INSTALLED:

  _tflow_select      anaconda/pkgs/main/linux-64::_tflow_select-2.1.0-gpu
  absl-py            anaconda/pkgs/main/linux-64::absl-py-0.8.1-py36_0
  astor              anaconda/pkgs/main/linux-64::astor-0.8.0-py36_0
  blas               anaconda/pkgs/free/linux-64::blas-1.0-mkl
  c-ares             anaconda/pkgs/main/linux-64::c-ares-1.15.0-h7b6447c_1001
  cudatoolkit        anaconda/pkgs/main/linux-64::cudatoolkit-10.0.130-0
  cudnn              anaconda/pkgs/main/linux-64::cudnn-7.6.4-cuda10.0_0
  cupti              anaconda/pkgs/main/linux-64::cupti-10.0.130-0
  gast               anaconda/pkgs/main/linux-64::gast-0.2.2-py36_0
  google-pasta       anaconda/pkgs/main/noarch::google-pasta-0.1.8-py_0
  grpcio             anaconda/pkgs/main/linux-64::grpcio-1.16.1-py36hf8bcb03_1
  h5py               anaconda/pkgs/main/linux-64::h5py-2.9.0-py36h7918eee_0
  hdf5               anaconda/pkgs/main/linux-64::hdf5-1.10.4-hb1b8bf9_0
  intel-openmp       anaconda/pkgs/main/linux-64::intel-openmp-2019.4-243
  keras-applications anaconda/pkgs/main/noarch::keras-applications-1.0.8-py_0
  keras-preprocessi~ anaconda/pkgs/main/noarch::keras-preprocessing-1.1.0-py_1
  libgfortran-ng     anaconda/pkgs/main/linux-64::libgfortran-ng-7.3.0-hdf63c60_0
  libprotobuf        anaconda/pkgs/main/linux-64::libprotobuf-3.10.1-hd408876_0
  markdown           anaconda/pkgs/main/linux-64::markdown-3.1.1-py36_0
  mkl                anaconda/pkgs/main/linux-64::mkl-2019.4-243
  mkl-service        anaconda/pkgs/main/linux-64::mkl-service-2.3.0-py36he904b0f_0
  mkl_fft            anaconda/pkgs/main/linux-64::mkl_fft-1.0.15-py36ha843d7b_0
  mkl_random         anaconda/pkgs/main/linux-64::mkl_random-1.1.0-py36hd6b4f25_0
  numpy              anaconda/pkgs/main/linux-64::numpy-1.17.4-py36hc1035e2_0
  numpy-base         anaconda/pkgs/main/linux-64::numpy-base-1.17.4-py36hde5b4d6_0
  opt_einsum         anaconda/pkgs/main/noarch::opt_einsum-3.1.0-py_0
  protobuf           anaconda/pkgs/main/linux-64::protobuf-3.10.1-py36he6710b0_0
  scipy              anaconda/pkgs/main/linux-64::scipy-1.3.2-py36h7c811a0_0
  six                anaconda/pkgs/main/linux-64::six-1.13.0-py36_0
  tensorboard        anaconda/pkgs/main/noarch::tensorboard-2.0.0-pyhb38c66f_1
  tensorflow         anaconda/pkgs/main/linux-64::tensorflow-2.0.0-gpu_py36h6b29c10_0
  tensorflow-base    anaconda/pkgs/main/linux-64::tensorflow-base-2.0.0-gpu_py36h0ec5d1f_0
  tensorflow-estima~ anaconda/pkgs/main/noarch::tensorflow-estimator-2.0.0-pyh2649769_0
  tensorflow-gpu     anaconda/pkgs/main/linux-64::tensorflow-gpu-2.0.0-h0d30ee6_0
  termcolor          anaconda/pkgs/free/linux-64::termcolor-1.1.0-py36_0
  werkzeug           anaconda/pkgs/main/noarch::werkzeug-0.16.0-py_0
  wrapt              anaconda/pkgs/main/linux-64::wrapt-1.11.2-py36h7b6447c_0

The following packages will be UPDATED:

  certifi            anaconda/pkgs/free::certifi-2016.2.28~ --> anaconda/pkgs/main::certifi-2019.11.28-py36_0
  setuptools         anaconda/pkgs/free::setuptools-36.4.0~ --> anaconda/pkgs/main::setuptools-42.0.2-py36_0

安装whl包的时候出现“tensorflow_gpu-1.3.0-cp36-cp36m-linux_x86_64.whl is not a supported wheel on this platform”的问题。我们需要下载GPU版的安装包,在安装包下载之后,然后手动进入环境,安装TensorFlow。

具体操作如下(因为我碰到这样问题,只能用下面这种方式安装了):

source activate tensorflow    #激活tensorflow环境(这步操作了,就忽略)
cd /Downloads    #切换到whl文件所在文件夹
pip install --ignore-installed --upgrade tensorflow_gpu-1.3.0-cp36-cp36m-linux_x86_64.whl   #切记,不要用sudo pip,也不要用pip3,然后--ignore-installed --upgrade等参数也不能省略,否则会出错。

安装好tensorflow在终端激活环境后进行测试出现import-im6.q16: not authorized `tf' @ error/constitute.c/WriteImage/1037错误

原因是激活环境后要先进入python环境,也就是继续在终端输入python进入环境后在输入import tensorflow as tf就行了

(base) zfy@zfy-N9x0TC:~$ source activate tensorflow
(tensorflow) zfy@zfy-N9x0TC:~$ cd Downloads
(tensorflow) zfy@zfy-N9x0TC:~/Downloads$ pip install --ignore-installed --upgrade tensorflow_gpu-1.14.0-cp37-cp37m-manylinux1_x86_64.whl
 

(tensorflow) zfy@zfy-N9x0TC:~/Downloads$ import tensorflow as tf
import-im6.q16: not authorized `tf' @ error/constitute.c/WriteImage/1037.
(tensorflow) zfy@zfy-N9x0TC:~$ python
Python 3.7.5 (default, Oct 25 2019, 15:51:11)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
/home/zfy/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/zfy/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/zfy/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/zfy/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/zfy/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/zfy/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
/home/zfy/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/zfy/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/zfy/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/zfy/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/zfy/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/zfy/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
>>

解决方案:

找到/home/hitwh/anaconda3/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/framework目录下的dtypes.py
将_np_quint8 = np.dtype([(“quint8”, np.uint8, 1)])改为

_np_quint8 = np.dtype([("quint8", np.uint8, (1,))])

然后就正常了
在这里插入图片描述
参考链接: https://blog.csdn.net/qq_41975844/article/details/99622948
 

>>> hello = tf.constant('hello,tensorflow')
>>> sess = tf.Session()
2019-12-18 19:56:18.727854: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcuda.so.1
2019-12-18 19:56:18.772612: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2019-12-18 19:56:18.772916: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties:
name: GeForce GTX 1660 Ti major: 7 minor: 5 memoryClockRate(GHz): 1.59
pciBusID: 0000:01:00.0
2019-12-18 19:56:18.772996: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcudart.so.10.0'; dlerror: libcudart.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda/lib64:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:
2019-12-18 19:56:18.773045: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcublas.so.10.0'; dlerror: libcublas.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda/lib64:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:
2019-12-18 19:56:18.773102: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcufft.so.10.0'; dlerror: libcufft.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda/lib64:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:
2019-12-18 19:56:18.773152: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcurand.so.10.0'; dlerror: libcurand.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda/lib64:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:
2019-12-18 19:56:18.773197: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcusolver.so.10.0'; dlerror: libcusolver.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda/lib64:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:
2019-12-18 19:56:18.773243: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcusparse.so.10.0'; dlerror: libcusparse.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda/lib64:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:
2019-12-18 19:56:18.893324: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudnn.so.7
2019-12-18 19:56:18.893416: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1663] Cannot dlopen some GPU libraries. Skipping registering GPU devices...
2019-12-18 19:56:18.894144: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-12-18 19:56:18.922259: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2904000000 Hz
2019-12-18 19:56:18.922891: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55848db69460 executing computations on platform Host. Devices:
2019-12-18 19:56:18.922910: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): <undefined>, <undefined>
2019-12-18 19:56:18.922986: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1181] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-12-18 19:56:18.922997: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1187]      
2019-12-18 19:56:18.995509: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2019-12-18 19:56:18.995842: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55848f0ac480 executing computations on platform CUDA. Devices:
2019-12-18 19:56:18.995860: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): GeForce GTX 1660 Ti, Compute Capability 7.5
>>> sess.run(hello)
b'hello,tensorflow'
>>> sess.close()

 上面出现了so文件找不到的错误

错误例子如下:

2019-12-18 19:56:18.773045: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcublas.so.10.0'; dlerror: libcublas.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda/lib64:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:

主要错误信息为Could not dlopen library 'libcublas.so.10.0'。造成这样的原因是链接文件不对造成的。

这种问题很好解决,下面我罗列一些常发生这样错误的so文件解决办法,首先大家要确定报错的so文件名称是什么,例如上面报错的是libcublas.so.10.0这个文件,那么就找到对应的libcublas库文件,然后在/usr/local/cuda-10.1/lib64/目录下创建一个bcublas.so.10.0连接文件即可。

一般缺失的so文件都在/usr/local/cuda/lib64/目录下,有一些特别的在/usr/lib/x86_64-linux-gnu/目录下。

    libcudart

    sudo ln -s /usr/local/cuda/lib64/libcudart.so.10.1 /usr/local/cuda/lib64/libcudart.so.10.0
    libcufft

    sudo ln -s /usr/local/cuda/lib64/libcufft.so.10.1.168 /usr/local/cuda/lib64/libcufft.so.10.0
 libcurand

    sudo ln -s /usr/local/cuda/lib64/libcurand.so.10.1.168 /usr/local/cuda/lib64/libcurand.so.10.0
  libcusolver

    sudo ln -s /usr/local/cuda/lib64/libcusolver.so.10.1.168 /usr/local/cuda/lib64/libcusolver.so.10.0
    libcusparse

    sudo ln -s /usr/local/cuda/lib64/libcusparse.so.10.1.168 /usr/local/cuda/lib64/libcusparse.so.10.0
 

libcublas

root@zfy-N9x0TC:/home/zfy# sudo rm -rf /usr/local/cuda/lib64/libcublas.so.10.0
root@zfy-N9x0TC:/home/zfy# sudo ln -s /usr/lib/x86_64-linux-gnu/libcublas.so.10.1.0.105 /usr/local/cuda/lib64/libcublas.so.10.0

 

    如果/usr/lib/x86_64-linux-gnu/目录下没有libcublas库,可以在/usr/local/cuda10.1/targets/x86_64-linux/lib/查找libcublas库。
 

查看numa是否支持

apt-get install numa

使用命令

numactl --hardware

(base) root@zfy-N9x0TC:/home/zfy# numactl --hardware
available: 1 nodes (0)
node 0 cpus: 0 1 2 3 4 5
node 0 size: 15875 MB
node 0 free: 9592 MB
node distances:
node   0
  0:  10

有多个node 即为numa系统.

 

1.配置一下anaconda的镜像:

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes

2.创建环境,输入

conda create -n tensorflow-gpu python=3.6 #这里的tensorflow-gpu是环境的名字

3.进入环境

conda activate tensorflow-gpu

4.下载tensorflow-gpu

pip install --upgrade --ignore-installed tensorflow-gpu

5.然后进入Python测试环境是否配置成功:

python

import tensorflow as tf #这里的tensorflow不能写成环境的名字
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

6.退出

先退出python

exit()

再推出anaconda,

conda deactivate

 

Anaconda创建环境:

conda create -n py36 python=3.6 

删除环境

conda remove -n py36 --all

激活环境

conda activate py36 

退出环境

conda deactivate

 

修改源方法:

临时使用: 
可以在使用pip的时候在后面加上-i参数,指定pip源 
eg: pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple   --trusted-host  pypi.tuna.tsinghua.edu.cn

永久修改: 
linux: 
修改 ~/.pip/pip.conf (没有就创建一个), 内容如下:

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

 

windows: 
直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini,内容如下

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

Anaconda 镜像使用帮助

Anaconda 是一个用于科学计算的 Python 发行版,支持 Linux, Mac, Windows, 包含了众多流行的科学计算、数据分析的 Python 包。

Anaconda 安装包可以到 https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/ 下载。

TUNA 还提供了 Anaconda 仓库与第三方源(conda-forge、msys2、pytorch等,查看完整列表)的镜像,各系统都可以通过修改用户目录下的 .condarc 文件:

channels:
  - defaults
show_channel_urls: true
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

即可添加 Anaconda Python 免费仓库。Windows 用户无法直接创建名为 .condarc 的文件,可先执行 conda config --set show_channel_urls yes 生成该文件之后再修改。

 

在已安装conda机器上配置国内镜像站

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

conda config --set show_channel_urls yes

 

添加清华镜像源

复制,粘贴,运行以下代码:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/

 

2019/5/5更新
由于清华镜像源关闭,需恢复官方源

conda config --remove-key channels

 

2019/6/22更新
Annaconda感受到了广大同胞在gayhub上的强烈呼声,镜像源又可以用了。

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

清华大学——Anaconda 镜像使用帮助

 

用户没有对anaconda3文件夹的读写权限解决方案:

造成其原因可能是由于在安装anaconda时使用了管理员权限。最简单的方法就是撤销对这个文件夹权限限制,定位到anaconda3同级文件夹下打开终端执行如下代码即可:

sudo chmod 777 -R anaconda3

报错解决方案:W: 目标 Sources (main/source/Sources) 在 /etc/apt/sources.list:2 和 /etc/apt/sources.list:7 中被配置了多次

vim /etc/apt/sources.list
查看第2行和第7行,发现重复。

第2行是 deb-src http://archive.ubuntu.com/ubuntu xenial main restricted
第7行是 deb-src http://archive.ubuntu.com/ubuntu xenial restricted
删除配置重复的部分。

修改ubuntu系统源

1. https://www.cnblogs.com/cymwill/p/10293205.html

2. https://blog.csdn.net/xiangxianghehe/article/details/80112149

ubuntu18.04 卸载与安装anaconda

1、删除Anaconda3文件夹

rm -rf ~/anaconda3

2、删除Anaconda·配置的环境变量

 sudo gedit ~/.bashrc

将末尾的此行删除

    # added by Anaconda3 installer
    export PATH="/home/Vselfdom/anaconda3/bin:$PATH"

此处的Vselfdom应为你的实际用户名

3、更新环境变量,使更改生效

source ~/.bashrc

ubuntu18.04降级gcc到4.8

(1). 下载gcc/g++ 4.8

$ sudo apt-get install -y gcc-4.8
$ sudo apt-get install -y g++-4.8

    1
    2

(2). 链接gcc/g++实现降级

$ cd /usr/bin
$ sudo rm gcc
$ sudo ln -s gcc-4.8 gcc
$ sudo rm g++
$ sudo ln -s g++-4.8 g++

依赖Anaconda环境安装TensorFlow库,避免采坑

https://www.cnblogs.com/xjx767361314/p/11103817.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值