Deepin+Anaconda+Vscode安装使用
第一步:下载sh脚本
第二步:安装脚本
cd 你的下载目录
sh ./anaconda-XXX-XXX.sh
第三步:修改安装路径
注意,安装路径最好是要是你作为普通用户有权限访问的目录。我是把opt目录以及下属所有目录文件全都设置了普通用户权限rwx,
第一个yes同意协议之后,第二个确定的地方是安装路径,不要使用/root目录,原因是anaconda不推荐root启动以及在root启动会有小问题,所以我的修改到/opt 目录之下,记录如下:
Anaconda3 will now be installed into this location:
/root/anaconda3
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
[/root/anaconda3] >>> /opt/anaconda
PREFIX=/opt/anaconda
Unpacking payload ...
Collecting package metadata (current_repodata.json): done
Solving environment: done
第四步:初始化anaconda
也就是添加命令,通常会有教程在你安装之后要你去/etc/profile添加path,但是,我听说,修改/etc/profile的话会出现各种小问题,最好是修改~/.bashrc。
这么复杂???不用,现在安装anaconda之后它会默认给你init一下,你只需要同意一下:
installation finished.
Do you wish the installer to initialize Anaconda3
by running conda init? [yes|no]
[no] >>> yes
Anaconda3-2020.02-Linux-x86_64.sh: 486: Anaconda3-2020.02-Linux-x86_64.sh: [[: not found
no change /opt/anaconda/condabin/conda
no change /opt/anaconda/bin/conda
no change /opt/anaconda/bin/conda-env
no change /opt/anaconda/bin/activate
no change /opt/anaconda/bin/deactivate
no change /opt/anaconda/etc/profile.d/conda.sh
no change /opt/anaconda/etc/fish/conf.d/conda.fish
no change /opt/anaconda/shell/condabin/Conda.psm1
no change /opt/anaconda/shell/condabin/conda-hook.ps1
no change /opt/anaconda/lib/python3.7/site-packages/xontrib/conda.xsh
no change /opt/anaconda/etc/profile.d/conda.csh
modified /root/.bashrc
==> For changes to take effect, close and re-open your current shell. <==
If you'd prefer that conda's base environment not be activated on startup,
set the auto_activate_base parameter to false:
conda config --set auto_activate_base false
Thank you for installing Anaconda3!
然后咱们去~/.bashrc看看init是怎样帮你的:
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/anaconda/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/opt/anaconda/etc/profile.d/conda.sh" ]; then
. "/opt/anaconda/etc/profile.d/conda.sh"
else
export PATH="/opt/anaconda/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
我记得这儿好像有个坑,就是安装的时候安装在opt目录的时候,需要root权限,所以conda路径配置的是root的,而我们平时使用普通用户的时候就没有conda命令。我都操作到这儿了,是手动修改的用户的~/.bashrc。(上面我说了最好使用普通权限安装在普通用户可以访问的目录)
第五步:新建python环境
使用这个命令:
conda create -n test python=3.7
#test为环境名称,后面的python=3.7为指定python版本
结果如下:
root@skyqin-PC:/opt/anaconda/bin# conda create -n test python=3.7
Collecting package metadata (current_repodata.json): done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.8.2
latest version: 4.8.3
Please update conda by running
$ conda update -n base -c defaults conda
## Package Plan ##
environment location: /opt/anaconda/envs/test
added / updated specs:
- python=3.7
The following packages will be downloaded:
package | build
---------------------------|-----------------
certifi-2020.4.5.1 | py37_0 155 KB
libffi-3.3 | he6710b0_1 50 KB
ncurses-6.2 | he6710b0_1 817 KB
openssl-1.1.1g | h7b6447c_0 2.5 MB
pip-20.0.2 | py37_3 1.7 MB
python-3.7.7 | hcff3b4d_5 45.1 MB
readline-8.0 | h7b6447c_0 356 KB
setuptools-46.4.0 | py37_0 514 KB
sqlite-3.31.1 | h62c20be_1 1.1 MB
xz-5.2.5 | h7b6447c_0 341 KB
------------------------------------------------------------
Total: 52.6 MB
The following NEW packages will be INSTALLED:
_libgcc_mutex pkgs/main/linux-64::_libgcc_mutex-0.1-main
ca-certificates pkgs/main/linux-64::ca-certificates-2020.1.1-0
certifi pkgs/main/linux-64::certifi-2020.4.5.1-py37_0
ld_impl_linux-64 pkgs/main/linux-64::ld_impl_linux-64-2.33.1-h53a641e_7
libedit pkgs/main/linux-64::libedit-3.1.20181209-hc058e9b_0
libffi pkgs/main/linux-64::libffi-3.3-he6710b0_1
libgcc-ng pkgs/main/linux-64::libgcc-ng-9.1.0-hdf63c60_0
libstdcxx-ng pkgs/main/linux-64::libstdcxx-ng-9.1.0-hdf63c60_0
ncurses pkgs/main/linux-64::ncurses-6.2-he6710b0_1
openssl pkgs/main/linux-64::openssl-1.1.1g-h7b6447c_0
pip pkgs/main/linux-64::pip-20.0.2-py37_3
python pkgs/main/linux-64::python-3.7.7-hcff3b4d_5
readline pkgs/main/linux-64::readline-8.0-h7b6447c_0
setuptools pkgs/main/linux-64::setuptools-46.4.0-py37_0
sqlite pkgs/main/linux-64::sqlite-3.31.1-h62c20be_1
tk pkgs/main/linux-64::tk-8.6.8-hbc83047_0
wheel pkgs/main/linux-64::wheel-0.34.2-py37_0
xz pkgs/main/linux-64::xz-5.2.5-h7b6447c_0
zlib pkgs/main/linux-64::zlib-1.2.11-h7b6447c_3
Proceed ([y]/n)? y
Downloading and Extracting Packages
python-3.7.7 | 45.1 MB | ############################################################################# | 100%
certifi-2020.4.5.1 | 155 KB | ############################################################################# | 100%
readline-8.0 | 356 KB | ############################################################################# | 100%
xz-5.2.5 | 341 KB | ############################################################################# | 100%
pip-20.0.2 | 1.7 MB | ############################################################################# | 100%
setuptools-46.4.0 | 514 KB | ############################################################################# | 100%
ncurses-6.2 | 817 KB | ############################################################################# | 100%
openssl-1.1.1g | 2.5 MB | ############################################################################# | 100%
sqlite-3.31.1 | 1.1 MB | ############################################################################# | 100%
libffi-3.3 | 50 KB | ############################################################################# | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
# $ conda activate test
#
# To deactivate an active environment, use
#
# $ conda deactivate
链接:
20171231Ubuntu+Anaconda+VSCode配置多Python开发环境_SONGYINGXU的博客-CSDN博客