如何在一个org文档里的代码片段运行不同的Python版本

在我的电脑上装有Python2版本的ipython虚拟环境,和Python3版本的虚拟环境.

#+BEGIN_SRC ipython :preamble # -*- 
coding: utf-8 -*- :results raw drawer values list :exports both :session
  import sys
  sys.version
#+END_SRC

运行改代码判断, 可以正确的输出ipython的版本2.7.10. 但是当我使用virtualwapper.el的命令venv_workon将虚拟环境切换至Python3后,并将#+BEGIN_SRC ipython…中的ipython修改成python后,再次运行该代码片段,并没有任何效果.相反的当再复原成#+BEGIN_SRC ipython…,并再使用venv_workon命令切换回ipython虚拟环境后,运行结果产生了错误,是ob-ipython提示的:Json error:josn readtable error. 在Github上查找相关的issue,也没有能够解决该提示错误的方法? ob-ipython的作者也没有给出答案? 我不知道我这样的做法对不对,如果有更好的解决方案能否分享?

我的配置,虚拟环境切换用的virtualwapper.el,运行ipython用的ob-ipython.el.

(defun dotspacemacs/user-init ()
  "Initialization function for user code.
It is called immediately after `dotspacemacs/init', before layer configuration
executes.
 This function is mostly us ful for variables that need to be set
before packages are loaded. If you are unsure, you should try in setting them in
`dotspacemacs/user-config' first."
(setq configuration-layer--elpa-archives
      '(("melpa"    . "https://melpa.org/packages/")
        ("melpa-cn" . "http://elpa.emacs-china.org/melpa/")
        ("org-cn"   . "http://elpa.emacs-china.org/org/")
        ("gnu-cn"   . "http://elpa.emacs-china.org/gnu/")
        ))
(setq tramp-ssh-controlmaster-options
      "-o ControlMaster=auto -o ControlPath='tramp.%%C' -o ControlPersist=no"))
 
(defun dotspacemacs/user-config ()
  "Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration.
This is the place where most of your configurations should be done. Unless it is
explicitly specified that a variable should be set before a package is loaded,
you should place your code here."
 
  (when (memq window-system '(mac ns))
    (exec-path-from-shell-initialize))
  (require 'ob-ipython)
  (require 'ein-dev)
  (require 'virtualenvwrapper)
  (eval-after-load "org"
    '(require 'ox-gfm nil t))
  (org-babel-do-load-languages
   'org-babel-load-languages
   '((python . t)
     (ipython . t)
     (js . t)
     (C . t)
     (sql . t)
     (sqlite . t)
     (dot . t)
     (emacs-lisp . t)
     (sh . t)))
  (global-company-mode 1)
  (global-hl-line-highlight)
  (require 'ox-latex)
  (require 'ox-md)
  (require 'nodejs-repl)
  ;; setup JavaScript auto-complete
  (setq tern-command '("node" "/usr/local/bin/tern"))
  (setq js2-include-node-externs t)
  ;; Set your lisp system and, optionally, some contribs
  (setq inferior-lisp-program "/usr/local/opt/sbcl/bin/sbcl")
  (setq slime-contribs '(slime-fancy))
  (setq org-confirm-babel-evaluate nil)
  (setq org-latex-create-formula-image-program 'dvipng)
  (setq org-latex-listings 'minted)
  (add-to-list 'org-latex-packages-alist '("" "minted"))
  (add-to-list 'org-entities-user
               '("exclamation" "\\exclamation{}" t "!" "!" "!" "!"))
  (setq org-export-backends (quote (ascii html icalendar latex md)))
  (setq org-src-fontify-natively t)
  (setq-default indent-tabs-mode nil)
  (setq default-tab-width 4)
  (setq c-default-style "k&r")
  (setq c-basic-offset 4)
  (setq ns-use-srgb-colorspace nil)
  (setq powerline-default-separator 'arrow)
  (setq ns-pop-up-frames nil)
  (setq spacemacs-show-trailing-whitespace t)
  (setq yas-snippet-dirs
        '("/Users/c/.spacemacs.d/snippets")
        )
  ;; 这样设置就不会导致`_`被org当做是下标符号, 相应的新下标符号是`_{}`.
  (setq org-export-with-sub-superscripts '{})
  ;; 让magit的窗口在右侧显示
  (setq split-height-threshold nil)
  (setq split-width-threshold 0)
  (setq ycmd-force-semantic-completion t)
  (setq company-backends-c-mode-common '((company-c-headers
                                          company-ycmd
                                          company-dabbrev :with company-yasnippet)))
  (setq venv-location "/Users/c/.virtualenvs")
  ;; Get color-theme-solarized working. It is specified as an additional package
  ;; above. First we setup some theme modifications - we must do this *before*
  ;; we load the theme. Note that the color-theme-solarized package appears in
  ;; the list of themes as plain old 'solarized'.
  (setq theming-modifications
      '((solarized
         ;; Provide a sort of "on-off" modeline whereby the current buffer has a nice
         ;; bright blue background, and all the others are in cream.
         ;; TODO: Change to use variables here. However, got error:
         ;; (Spacemacs) Error in dotspacemacs/user-config: Wrong type argument: stringp, pd-blue
         (mode-line :foreground "#e9e2cb" :background "#2075c7" :inverse-video nil)
         (powerline-active1 :foreground "#e9e2cb" :background "#2075c7" :inverse-video nil)
         (powerline-active2 :foreground "#e9e2cb" :background "#2075c7" :inverse-video nil)
         (mode-line-inactive :foreground "#2075c7" :background "#e9e2cb" :inverse-video nil)
         (powerline-inactive1 :foreground "#2075c7" :background "#e9e2cb" :inverse-video nil)
         (powerline-inactive2 :foreground "#2075c7" :background "#e9e2cb" :inverse-video nil)
         ;; Make a really prominent helm selection line.
         (helm-selection :foreground "white" :background "red" :inverse-video nil)
         ;; See comment above about dotspacemacs-colorize-cursor-according-to-state.
         (cursor :background "#b58900")
         (ivy-current-match :foreground "white" :background "#555555" :inverse-video nil)
         (ivy-minibuffer-match-face-2 :background "#555555")
       )))
  
  ;; Turn this off to stop it interfering with mic-paren.
  (set-face-attribute 'sp-show-pair-match-face nil :foreground 'unspecified :background 'unspecified)
  (set-face-attribute 'sp-show-pair-mismatch-face nil :foreground 'unspecified :background 'unspecified)
  (set-terminal-parameter nil 'background-mode 'dark)
  (set-frame-parameter nil 'background-mode 'dark)
  (spacemacs/load-theme 'solarized)
 
  (venv-initialize-interactive-shells)
  (venv-initialize-eshell)
 
  (set-variable 'ycmd-server-command '("python" "/Users/c/YouCompleteMe/third_party/ycmd/ycmd/"))
  (set-variable 'ycm-global-config "/Users/c/.ycm_extra_conf.py")
  (setcdr evil-insert-state-map nil)
  
 
  (add-hook 'c++-mode-hook 'ycmd-mode)
  (add-hook 'python-mode-hook 'ycmd-mode)
  (add-hook 'prog-mode-hook 'turn-on-fci-mode)
  (add-hook 'c-mode-hook (lambda ()
                           (electric-indent-mode -1)))
 
  (add-to-list 'load-path "/path/to/dash-at-point")
  (autoload 'dash-at-point "dash-at-point"
    "Search the word at point with Dash." t nil)
  (add-to-list 'dash-at-point-mode-alist '(c-mode . "C"))
  (define-key evil-insert-state-map [escape] 'evil-normal-state)
  (spacemacs/set-leader-keys "ha" 'toggle-frame-fullscreen)
  (spacemacs/set-leader-keys "hc" 'evil-invert-char)
  (spacemacs/set-leader-keys "hu" 'evil-invert-case)
  (spacemacs/set-leader-keys "h;" 'comment-line)
  (spacemacs/set-leader-keys "hs" 'org-screenshot)
  (spacemacs/set-leader-keys "hS" 'org-delete-screenshot-image-file-and-link)
  (spacemacs/set-leader-keys "he" 'org-dot-image-to-base64-converter)
  (spacemacs/set-leader-keys "hE" 'org-delete-dot-image-file-and-link)
  (spacemacs/set-leader-keys "hp" 'dash-at-point-with-docset)
  (spacemacs/set-leader-keys "hP" 'dash-at-point)
  (spacemacs/set-leader-keys "so" 'occur-dwin)
  (spacemacs/set-leader-keys "ii" 'ein:worksheet-insert-cell-below)
  (spacemacs/set-leader-keys "iI" 'ein:worksheet-insert-cell-above)
  (spacemacs/set-leader-keys "it" 'ein:worksheet-change-cell-type)
  (spacemacs/set-leader-keys "id" 'ein:worksheet-kill-cell)
  (spacemacs/set-leader-keys "is" 'ein:notebook-save-notebook-command)
  (spacemacs/set-leader-keys "oi" 'org-insert-src-block)
  (spacemacs/set-leader-keys "oe" 'org-edit-special)
  (spacemacs/set-leader-keys "or" 'org-src-do-at-code-block)
  (spacemacs/set-leader-keys "oc" 'org-gfm-export-to-markdown-filter)
  (spacemacs/set-leader-keys "fs" 'save-buffer-filter)
  )