如何将 wxPython 安装到特定的 VsCode Python?

How do I install wxPython into a specific VsCode Python?

运行最新的VsCode在Windows10下,我已经从终端window安装了wxPython到Python3.6 .3 标准环境(当我问 python -V 时它提到的那个)。

在 VsCode 内,只要我 select 那个环境 (Python 3.6.3 32-bit),我的应用程序运行良好。

但是,如果我切换到我的其他两个环境中的任何一个,Python 3.6.6 64-bitPython 3.7.2 32-bitimport wx 会失败,大概是因为我没有 pip install-将 wxPython 编辑到这些环境中。

我该怎么做,pip install 将一个包放入 特定的 环境中配置 VsCode?

我看到,当 VsCode 运行 我的应用程序时,它会执行以下操作:

cd 'c:\Users\Pax\Documents\pysrc';
${env:PYTHONIOENCODING}='UTF-8'; ${env:PYTHONUNBUFFERED}='1'; &
    'C:\Users\Pax\AppData\Local\Programs\Python\Python36-32\python.exe'
    'c:\Users\Pax\.vscode\extensions\blah\blah\ptvsd_launcher.py'
    '--default' '--client' '--host' 'localhost' '--port' '53664'
    '-m' 'myapp.py'

当 运行 pip 时,我是否需要做一些类似的不透明操作?

是的,您必须将它安装到您要使用它的每个 Python环境中。

假设您使用的是标准设置,这可能很简单:

C:\Users\Pax\AppData\Local\Programs\Python\Python37-32\Scripts\pip.exe install wxpython

这将 pip install wxpython 进入 特定的 环境(在本例中为 Python 3.7)并允许您在 Python VsCode.

内的代码 运行

我只需要在 Linux Mint 19 的终端中使用 pip3 而不是 pip