title: How do I change pipenv/virtualenv location to work with Portable VS Code and project on thumb drive?
body: <p>On Windows 10, I'm running VS Code 1.48.2 and Python 3, both installed on a thumb drive. I added an <code>F:\Programs\VS Code\data</code> folder with <code>user-data</code> and<code>extensions</code>. My project directory is <code>F:\MyProject</code> and it has a Pipfile. My project directory has a <code>.env</code> file and <code>.venv\</code> so that <code>pipenv</code> will install to the local <code>.venv\</code>. What else do I need to get this environment working? Thanks!<br/></p>
  <p><code>.env</code> file:</p>
  <pre><code>PYTHONPATH=&quot;F:\\Python\\Python38\\python.exe&quot;
  PYTHONHOME=&quot;F:\\MyProject\\.venv\\Scripts&quot;
  PIPENV_VENV_IN_PROJECT=True
  </code></pre>
  <p><code>F:\MyProject\.vscode\settings.json</code> file:</p>
  <pre><code>{
      &quot;python.pythonPath&quot;: &quot;f:\\MyProject\\.venv\\Scripts\\python.exe&quot;
  }
  </code></pre>
  <p>Although, when I used <code>Preferences: Open Settings</code>, it opened my <code>F:\Programs\VS Code\data\user-data\settings.json</code> file, though the paths look right (to me):</p>
  <pre><code>{
      &quot;editor.suggestSelection&quot;: &quot;first&quot;,
      &quot;vsintellicode.modify.editor.suggestSelection&quot;: &quot;automaticallyOverrodeDefaultValue&quot;,
      &quot;python.languageServer&quot;: &quot;Microsoft&quot;,
      &quot;python.pythonPath&quot;: &quot;${workspacefolder}/.venv/Scripts/python.exe&quot;,
      &quot;python.venvPath&quot;: &quot;${workspacefolder}/.venv&quot;,
      &quot;python.venvFolders&quot;: [
          &quot;.venv&quot;,
          &quot;${workspacefolder}/.venv&quot;
      ]
  }
  </code></pre>
  <p>Used the following steps to setup:</p>
  <pre><code>ps &gt; cd F:\MyProject
  ps &gt; F:\Programs\VS Code\code.exe .
  
  [In vscode integrated terminal]
  PS F:\MyProject&gt; py -m venv --system-site-packages .venv
  PS F:\MyProject&gt; pipenv shell
  Loading .env environment variables…
  Warning: Your Pipfile requires python_version 3.8, but you are using unknown (F:\M\.venv\S\python.exe).
    $ pipenv --rm and rebuilding the virtual environment may resolve the issue.
    $ pipenv check will surely fail.
  Launching subshell in virtual environment…
  Windows PowerShell
  Copyright (C) Microsoft Corporation. All rights reserved.
  
  Try the new cross-platform PowerShell https://aka.ms/pscore6
  
  PS F:\MyProject&gt; ls .\.venv\Scripts\python.exe
  
      Directory: F:\MyProject\.venv\Scripts
  
  Mode                LastWriteTime         Length Name
  ----                -------------         ------ ----
  -a----           9/6/20   3:04 PM         532040 python.exe
  
  PS F:\MyProject&gt; python where
  Python path configuration:
    PYTHONHOME = 'F:\MyProject\.venv\Scripts'
    PYTHONPATH = 'F:\Python\Python38\python.exe'
    program name = 'F:\Python\Python38\python.exe'
    isolated = 0
    environment = 1
    user site = 1
    import site = 1
    sys._base_executable = 'F:\\Python\\Python38\\python.exe'
    sys.base_prefix = 'F:\\MyProject\\.venv\\Scripts'
    sys.base_exec_prefix = 'F:\\MyProject\\.venv\\Scripts'
    sys.executable = 'F:\\MyProject\\.venv\\Scripts\\python.exe'
    sys.prefix = 'F:\\MyProject\\.venv\\Scripts'
    sys.exec_prefix = 'F:\\MyProject\\.venv\\Scripts'
    sys.path = [
      'F:\\Python\\Python38\\python.exe',
      'F:\\Python\\Python38\\python38.zip',
      'F:\\MyProject\\.venv\\Scripts\\DLLs',
      'F:\\MyProject\\.venv\\Scripts\\lib',
      'F:\\Python\\Python38',
    ]
  Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
  Python runtime state: core initialized
  ModuleNotFoundError: No module named 'encodings'
  
  Current thread 0x000020d4 (most recent call first):
  &lt;no Python frame&gt;
  PS F:\MyProject&gt;
  </code></pre>