解决conda下jupyter不加载环境库的问题

在conda下创建虚拟环境,但是用jupyter运行时,总是提示找不到库,琢磨半天发现是ipython的问题,虚拟环境下没有安装,默认调用默认环境的ipython。

古pip安装ipython即可解决问题。

如下所示。

(tf2.1) C:\Users\Administrator>pip install ipython
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Requirement already satisfied: ipython in c:\users\administrator\anaconda3\envs\tf2.1\lib\site-packages (6.5.0)
Collecting pickleshare
  Downloading https://mirrors.aliyun.com/pypi/packages/9a/41/220f49aaea88bc6fa6cba8d05ecf24676326156c23b991e80b3f2fc24c77/pickleshare-0.7.5-py2.py3-none-any.whl (6.9 kB)
Processing c:\users\administrator\appdata\local\pip\cache\wheels\58\ba\27\dcfa1b9ea503395de43971aa22e7c642f3cd8d71730cd94bac\backcall-0.1.0-cp37-none-any.whl
Collecting decorator
  Downloading https://mirrors.aliyun.com/pypi/packages/ed/1b/72a1821152d07cf1d8b6fce298aeb06a7eb90f4d6d41acec9861e7cc6df0/decorator-4.4.2-py2.py3-none-any.whl (9.2 kB)
Collecting jedi>=0.10
  Downloading https://mirrors.aliyun.com/pypi/packages/01/67/333e2196b70840f411fd819407b4e98aa3150c2bd24c52154a451f912ef2/jedi-0.16.0-py2.py3-none-any.whl (1.1 MB)
     |████████████████████████████████| 1.1 MB 2.2 MB/s
Collecting traitlets>=4.2
  Downloading https://mirrors.aliyun.com/pypi/packages/ca/ab/872a23e29cec3cf2594af7e857f18b687ad21039c1f9b922fac5b9b142d5/traitlets-4.3.3-py2.py3-none-any.whl (75 kB)
     |████████████████████████████████| 75 kB 5.5 MB/s
Requirement already satisfied: setuptools>=18.5 in c:\users\administrator\anaconda3\envs\tf2.1\lib\site-packages (from ipython) (46.0.0.post20200309)
Collecting simplegeneric>0.8
  Downloading https://mirrors.aliyun.com/pypi/packages/3d/57/4d9c9e3ae9a255cd4e1106bb57e24056d3d0709fc01b2e3e345898e49d5b/simplegeneric-0.8.1.zip (12 kB)
Collecting prompt-toolkit<2.0.0,>=1.0.15
  Downloading https://mirrors.aliyun.com/pypi/packages/64/27/5fd61a451d086ad4aa806dc72fe1383d2bc0e74323668672287f616d5d51/prompt_toolkit-1.0.18-py3-none-any.whl (245 kB)
     |████████████████████████████████| 245 kB 6.4 MB/s
Collecting pygments
  Downloading https://mirrors.aliyun.com/pypi/packages/2d/68/106af3ae51daf807e9cdcba6a90e518954eb8b70341cee52995540a53ead/Pygments-2.6.1-py3-none-any.whl (914 kB)
     |████████████████████████████████| 914 kB 6.4 MB/s
Collecting colorama; sys_platform == "win32"
  Downloading https://mirrors.aliyun.com/pypi/packages/c9/dc/45cdef1b4d119eb96316b3117e6d5708a08029992b2fee2c143c7a0a5cc5/colorama-0.4.3-py2.py3-none-any.whl (15 kB)
Collecting parso>=0.5.2
  Downloading https://mirrors.aliyun.com/pypi/packages/da/15/888f80e429a971d3838124adde705d7b07650aa3a59f4db07d61f653b8cd/parso-0.6.2-py2.py3-none-any.whl (97 kB)
     |████████████████████████████████| 97 kB 1.1 MB/s
Requirement already satisfied: ipython-genutils in c:\users\administrator\anaconda3\envs\tf2.1\lib\site-packages (from traitlets>=4.2->ipython) (0.2.0)
Requirement already satisfied: six in c:\users\administrator\anaconda3\envs\tf2.1\lib\site-packages (from traitlets>=4.2->ipython) (1.14.0)
Collecting wcwidth
  Downloading https://mirrors.aliyun.com/pypi/packages/58/b4/4850a0ccc6f567cc0ebe7060d20ffd4258b8210efadc259da62dc6ed9c65/wcwidth-0.1.8-py2.py3-none-any.whl (17 kB)
Building wheels for collected packages: simplegeneric
  Building wheel for simplegeneric (setup.py) ... done
  Created wheel for simplegeneric: filename=simplegeneric-0.8.1-py3-none-any.whl size=5080 sha256=3e797e404d272953ef31dde43c05faa85719cd37b6dd696aaee448b4f147cc6d
  Stored in directory: c:\users\administrator\appdata\local\pip\cache\wheels\47\72\93\bcae887825d4e3cf99abddc21f777340850817dc394128b639
Successfully built simplegeneric
Installing collected packages: pickleshare, backcall, decorator, parso, jedi, traitlets, simplegeneric, wcwidth, prompt-toolkit, pygments, colorama
Successfully installed backcall-0.1.0 colorama-0.4.3 decorator-4.4.2 jedi-0.16.0 parso-0.6.2 pickleshare-0.7.5 prompt-toolkit-1.0.18 pygments-2.6.1 simplegeneric-0.8.1 traitlets-4.3.3 wcwidth-0.1.8

(tf2.1) C:\Users\Administrator>
(tf2.1) C:\Users\Administrator>
(tf2.1) C:\Users\Administrator>
(tf2.1) C:\Users\Administrator>
(tf2.1) C:\Users\Administrator>ipython
Python 3.7.6 (default, Jan  8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 6.5.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import tensorflow as tf
2020-03-16 11:44:11.597928: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll

 

你可能感兴趣的:(python)