Skip to main content

Command Palette

Search for a command to run...

Conda env + Install jupyter

Published
2 min readView as Markdown
Conda env + Install jupyter
C
酷愛計算機技術Ardently Love Computer Technology 長期關註反洗錢反欺詐Long-term Focus on Anti-Money Laundering and Anti-Fraud 精通支付結算的技術、系統、流程和製度Proficient in the Technology, System, Process and Institution of Payment and Settlement

For Backup


编辑 /etc/apt/sources.list 文件

deb https://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main non-free contrib
deb-src https://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main non-free contrib

更改完 sources.list 文件后,运行 sudo apt update 更新索引以生效

当前 python 版本

# python -V
Python 3.11.9

当前 pip 版本

# pip -V   
pip 24.1.1 from /usr/lib/python3/dist-packages/pip (python 3.11)

下载最新 miniconda 脚本

$ wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py312_24.9.2-0-Linux-x86_64.sh

$ file Miniconda3-py312_24.9.2-0-Linux-x86_64.sh 
Miniconda3-py312_24.9.2-0-Linux-x86_64.sh: POSIX shell script, ASCII text executable, with very long lines (2754)

以 root 身份安装

# sh Miniconda3-py312_24.9.2-0-Linux-x86_64.sh 
Welcome to Miniconda3 py312_24.9.2-0
In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>> 
ANACONDA TERMS OF SERVICE
...
Do you accept the license terms? [yes|no]
>>> yes
Miniconda3 will now be installed into this location:
/root/miniconda3
  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below
[/root/miniconda3] >>> 
...
You can undo this by running `conda init --reverse $SHELL`? [yes|no]
[no] >>> yes
...
==> For changes to take effect, close and re-open your current shell. <==
Thank you for installing Miniconda3!

按照提示,得退出再重开 shell 才能生效

(base) # python -V
Python 3.12.7

# conda -V                                
conda 24.9.2

安装 3.9 版本的 python

# conda create --name python309 python=3.9
Channels:
 - defaults
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: done
...
The following NEW packages will be INSTALLED:
...
Proceed ([y]/n)? y
Downloading and Extracting Packages:                                                                                                                               
Preparing transaction: done                                                                                                                      
Verifying transaction: done                                                                                                                      
Executing transaction: done

安装 3.13 版本的 python

# conda create --name python313 python=3.13
Channels:
 - defaults
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: done
...
The following NEW packages will be INSTALLED:
...
Proceed ([y]/n)? y
Downloading and Extracting Packages:                                                                                                                                         
Preparing transaction: done                                                                                                                      
Verifying transaction: done                                                                                                                      
Executing transaction: done

激活 3.9 版本的 python

(base) # conda activate python309                                                                                                                        
(python309) # python -V
Python 3.9.20

激活 3.13 版本的 python

(python309) # conda activate python313                                                                                                                                                
(python313) # python -V               
Python 3.13.0

回到基础版本的 python

(python313) # conda deactivate                                                                                                                                                   
(python309) # conda deactivate                                                                                                                             
(base) # python -V               
Python 3.12.7

切换到 3.9 版本的 python 并更换pip源设置,使用清华源,安装 pyecharts

(python309) # pip install pyecharts -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
(python309) # pip list                                                                      
Package      Version
------------ -------
Jinja2       3.1.4
MarkupSafe   3.0.2
pip          24.2
prettytable  3.12.0
pyecharts    2.0.7
setuptools   75.1.0
simplejson   3.19.3
some-package 0.1
wcwidth      0.2.13
wheel        0.44.0

安装 jupyter

(python309) # apt-get install jupyter

运行 jupyter notebook

# jupyter notebook
Running as root is not recommended. Use --allow-root to bypass.

按照提示添加 --allow-root 参数

# jupyter notebook --allow-root
Jupyter Notebook 6.4.13 is running at:

浏览器成功打开

More from this blog

Penetration Test、Python、Weaponization

721 posts

微信 smartcat9999 反欺詐Anti-Fraud 反洗錢Anti-Money Laundering 反逃稅Anti-Tax Evasion 滲透測試Penetration Test 武器化Weaponization