记录一下安装pandas的步骤以及输出:
启动python解释器,调用系统默认Python环境
bash展开代码(base) cc@LAPTOP-2A2OV24P:~$ python
Python 3.13.5 | packaged by Anaconda, Inc. | (main, Jun 12 2025, 16:09:02) [GCC 11.2.0 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
检查Python路径,显示默认Python解释器的实际路径
bash展开代码(base) cc@LAPTOP-2A2OV24P:~$ which python
/home/cc/miniconda3/bin/python #输出
检查Conda路径,确认Conda的安装位置
bash展开代码(base) cc@LAPTOP-2A2OV24P:~$ which conda
/home/cc/miniconda3/bin/conda
直接调用绝对路径的Python:/home/cc/miniconda3/bin/python→ 效果与步骤1相同
bash展开代码(base) cc@LAPTOP-2A2OV24P:~$ /home/cc/miniconda3/bin/python
Python 3.13.5 | packaged by Anaconda, Inc. | (main, Jun 12 2025, 16:09:02) [GCC 11.2.0 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
尝试创建新Conda环境→ 准备创建名为 py310的新环境
bash展开代码conda create -n py310
激活py310环境,并检查python路径
bash展开代码conda activate py310
which python
实践:
bash展开代码(base) cc@LAPTOP-2A2OV24P:~$ conda activate py310
(py310) cc@LAPTOP-2A2OV24P:~$ conda env list
# conda environments:
#
base /home/cc/miniconda3
py310 * /home/cc/miniconda3/envs/py310
(py310) cc@LAPTOP-2A2OV24P:~$ which python
/home/cc/miniconda3/envs/py310/bin/python
切换回base环境,并验证python路径
bash展开代码conda activate base
which python
实践:
bash展开代码```bash
(py310) cc@LAPTOP-2A2OV24P:~$ conda activate base
(base) cc@LAPTOP-2A2OV24P:~$ which python
/home/cc/miniconda3/bin/python
返回py310环境安装pandas
bash展开代码conda activate py310 pip install pandas
在特定环境下执行的命令(如pip install)仅作用于当前环境
本文作者:cc
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!