Python Pip不';我在jupyter笔记本里再也不能工作了

Python Pip不';我在jupyter笔记本里再也不能工作了,python,python-3.x,pip,jupyter-notebook,Python,Python 3.x,Pip,Jupyter Notebook,我曾经能够从jupyter笔记本启动pip命令。但是现在即使我连基本的都乱了!pip-V我得到: --------------------------------------------------------------------------- FileNotFoundError Traceback (most recent call last) <ipython-input-17-29b4bf94a9cf> in <modu

我曾经能够从jupyter笔记本启动pip命令。但是现在即使我连基本的
都乱了!pip-V
我得到:

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-17-29b4bf94a9cf> in <module>
----> 1 get_ipython().system(' pip -V')

C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py in system_piped(self, cmd)
   2450         # a non-None value would trigger :func:`sys.displayhook` calls.
   2451         # Instead, we store the exit_code in user_ns.
-> 2452         self.user_ns['_exit_code'] = system(self.var_expand(cmd, depth=1))
   2453 
   2454     def system_raw(self, cmd):

C:\ProgramData\Anaconda3\lib\site-packages\IPython\utils\_process_win32.py in system(cmd)
    129         if path is not None:
    130             cmd = '"pushd %s &&"%s' % (path, cmd)
--> 131         return process_handler(cmd, _system_body)
    132 
    133 def getoutput(cmd):

C:\ProgramData\Anaconda3\lib\site-packages\IPython\utils\_process_common.py in process_handler(cmd, callback, stderr)
     82                          stdout=subprocess.PIPE,
     83                          stderr=stderr,
---> 84                          close_fds=close_fds)
     85 
     86     try:

C:\ProgramData\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
    773                                 c2pread, c2pwrite,
    774                                 errread, errwrite,
--> 775                                 restore_signals, start_new_session)
    776         except:
    777             # Cleanup if the child failed starting.

C:\ProgramData\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
   1176                                          env,
   1177                                          os.fspath(cwd) if cwd is not None else None,
-> 1178                                          startupinfo)
   1179             finally:
   1180                 # Child is launched. Close the parent's copy of those pipe

FileNotFoundError: [WinError 2] The system cannot find the file specified

Blockquote
但是得到了以下一个:

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-20-378e12e263ed> in <module>
      1 import sys
----> 2 get_ipython().system('{sys.executable} -m pip install facebook_sdk')
      3 

C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py in system_piped(self, cmd)
   2450         # a non-None value would trigger :func:`sys.displayhook` calls.
   2451         # Instead, we store the exit_code in user_ns.
-> 2452         self.user_ns['_exit_code'] = system(self.var_expand(cmd, depth=1))
   2453 
   2454     def system_raw(self, cmd):

C:\ProgramData\Anaconda3\lib\site-packages\IPython\utils\_process_win32.py in system(cmd)
    129         if path is not None:
    130             cmd = '"pushd %s &&"%s' % (path, cmd)
--> 131         return process_handler(cmd, _system_body)
    132 
    133 def getoutput(cmd):

C:\ProgramData\Anaconda3\lib\site-packages\IPython\utils\_process_common.py in process_handler(cmd, callback, stderr)
     82                          stdout=subprocess.PIPE,
     83                          stderr=stderr,
---> 84                          close_fds=close_fds)
     85 
     86     try:

C:\ProgramData\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
    773                                 c2pread, c2pwrite,
    774                                 errread, errwrite,
--> 775                                 restore_signals, start_new_session)
    776         except:
    777             # Cleanup if the child failed starting.

C:\ProgramData\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
   1176                                          env,
   1177                                          os.fspath(cwd) if cwd is not None else None,
-> 1178                                          startupinfo)
   1179             finally:
   1180                 # Child is launched. Close the parent's copy of those pipe

FileNotFoundError: [WinError 2] The system cannot find the file specified
升级Anaconda提示符中的pip
但是在关闭内核、关闭jupyter窗口终端后仍然出现错误。

所以您使用的是conda和Pip。。。为什么不试试从康达安装pip

很抱歉没有评论,但我没有足够的声誉

conda install pip

你尝试升级pip了吗?@KavithaKarunakaran刚刚尝试升级,但仍然存在此错误。这表明没有足够的文件权限在升级时使用conda pip安装修改pip。我想知道这是否与
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-6-6460b4216065> in <module>
----> 1 get_ipython().run_line_magic('conda', 'install pip')

C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2311                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2312             with self.builtin_trap:
-> 2313                 result = fn(*args, **kwargs)
   2314             return result
   2315 

<C:\ProgramData\Anaconda3\lib\site-packages\decorator.py:decorator-gen-108> in conda(self, line)

C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\magics\packaging.py in conda(self, line)
    101             extra_args.extend(["--prefix", sys.prefix])
    102 
--> 103         self.shell.system(' '.join([conda, command] + extra_args + args))
    104         print("\nNote: you may need to restart the kernel to use updated packages.")

C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py in system_piped(self, cmd)
   2450         # a non-None value would trigger :func:`sys.displayhook` calls.
   2451         # Instead, we store the exit_code in user_ns.
-> 2452         self.user_ns['_exit_code'] = system(self.var_expand(cmd, depth=1))
   2453 
   2454     def system_raw(self, cmd):

C:\ProgramData\Anaconda3\lib\site-packages\IPython\utils\_process_win32.py in system(cmd)
    129         if path is not None:
    130             cmd = '"pushd %s &&"%s' % (path, cmd)
--> 131         return process_handler(cmd, _system_body)
    132 
    133 def getoutput(cmd):

C:\ProgramData\Anaconda3\lib\site-packages\IPython\utils\_process_common.py in process_handler(cmd, callback, stderr)
     82                          stdout=subprocess.PIPE,
     83                          stderr=stderr,
---> 84                          close_fds=close_fds)
     85 
     86     try:

C:\ProgramData\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
    773                                 c2pread, c2pwrite,
    774                                 errread, errwrite,
--> 775                                 restore_signals, start_new_session)
    776         except:
    777             # Cleanup if the child failed starting.

C:\ProgramData\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
   1176                                          env,
   1177                                          os.fspath(cwd) if cwd is not None else None,
-> 1178                                          startupinfo)
   1179             finally:
   1180                 # Child is launched. Close the parent's copy of those pipe

FileNotFoundError: [WinError 2] The system cannot find the file specified
(base) C:\Users\antoi>python -m pip install --upgrade pip
Collecting pip
  Using cached https://files.pythonhosted.org/packages/30/db/9e38760b32e3e7f40cce46dd5fb107b8c73840df38f0046d8e6514e675a1/pip-19.2.3-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 19.1.1
    Uninstalling pip-19.1.1:
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'c:\\programdata\\anaconda3\\lib\\site-packages\\pip\\_internal\\build_env.py'
Consider using the `--user` option or check the permissions.


(base) C:\Users\antoi>
(base) C:\Users\antoi>python -m pip install --upgrade pip --user
Collecting pip
  Using cached https://files.pythonhosted.org/packages/30/db/9e38760b32e3e7f40cce46dd5fb107b8c73840df38f0046d8e6514e675a1/pip-19.2.3-py2.py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-19.2.3
conda install pip