conda create -n test python=3.9
问题
使用conda创建虚拟环境test后,虚拟环境中python为3.9,使用pip安装numpy等,在使用时找不到
[root@z /]# python
Python 3.9.12 | packaged by conda-forge | (main, Mar 24 2022, 23:22:55)
[GCC 10.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'numpy'
再次安装时出现,发现已经安装,但是指向到了外部的python 3.6
[root@z /]# pip install numpy
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: numpy in /data/anaconda3/lib/python3.6/site-packages (1.19.5)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recom