当你想要在conda指定的某个环境中安装包的方法
1)使用conda install -n 环境名 包名
userdeMBP:pytorch user$ conda install -n deeplearning2 tensorflow
2)进入环境,在环境中使用pip install命令:
userdeMacBook-Pro:classifier cifar user$ conda activate deeplearning (deeplearning) userdeMacBook-Pro:classifier cifar user$ pip install tensorflow Collecting tensorflow ...
然后查看:
(deeplearning) userdeMBP:~ user$ python Python 3.7.2 (default, Dec 29 2018, 00:00:04) [Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import tensorflow >>> tensorflow.__version__ '1.13.1' >>>
可见安装了1.13.1版本的tensorflow
3.使用anaconda navigator安装,详情可见jupyter notebook中No module named 'tensorflow'