我试图在用Anaconda创建的新创建的虚拟环境中安装一些软件包。
创建新的环境:
kali@kali: conda create --name py2 python=2.7
现在在提示的开头添加了激活环境(py2)
kali@kali: conda activate py2
确保环境中已安装pip:
(py2) kali@kali: conda install pip
我检查了环境中是否成功安装了安装程序
(py2) kali@kali: cd ~/anaconda3/envs/py2/bin
我还在pip安装上执行了“ which”命令:
(py2) kali@kali: which ~/anaconda3/envs/py2/bin/pip
Result:
/home/kali/anaconda3/envs/py2/bin/pip
直接在文件夹内调用pip安装时:
(py2) kali@kali: ~/anaconda3/envs/py2/bin/pip --version
Result:
pip 20.2.4 from /home/kali/anaconda3/envs/py2/lib/python2.7/site-packages/pip (python 2.7)
但是,当我尝试安装模块时,它始终指向环境外部:
(py2) kali@kali: /home/kali/anaconda3/envs/py2/bin/pip install pycrypto
Requirement already satisfied: pycrypto in /home/kali/.local/lib/python2.7/site-packages (2.6.1)