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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章