title: Missing files after using cx_freeze, exe runs in Anaconda prompt but not in cmd
body: <p>I ran into some problems with using <code>cx_freeze</code> to create executables from python code. The built executables run from the Anaconda prompt, but when run in windows cmd (or via click on the .exe) the program exits with an error message related to the requests package.</p>
  
  <p>Here is a minimal working example. First, the script that will be frozen: <code>main.py</code></p>
  
  <pre class="lang-py prettyprint-override"><code>import requests
  
  r = requests.get('https://github.com/')
  
  print(r.text)
  </code></pre>
  
  <p>Secondly, the setup script for <code>cx_freeze</code>: <code>setup.py</code></p>
  
  <pre class="lang-py prettyprint-override"><code>import cx_Freeze
  
  build_exe_options = {
          "includes": [],
          'include_files': [],
          'excludes' : [],
          'packages' : []
             }
  
  base = None
  
  executables = [cx_Freeze.Executable('main.py',
                                      base=base)]
  
  cx_Freeze.setup(name = "MWE",
                  options = {"build_exe": build_exe_options},
                  executables = executables)
  </code></pre>
  
  <p>Here is the problem:</p>
  
  <ol>
  <li>Running <code>main.py</code> in python works as expected</li>
  <li>Building the executable via <code>python setup.py build</code> works fine</li>
  <li>Running the resulting <code>main.exe</code> in the Anaconda prompt works as expected</li>
  <li><p>Running <code>main.exe</code> in the windows cmd (or starting via mouse-click) exits with the following error message:</p>
  
  <pre class="lang-py prettyprint-override"><code>Traceback (most recent call last):
    File "P:\Anaconda3\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 40, in run
      module.run()
    File "P:\Anaconda3\lib\site-packages\cx_Freeze\initscripts\Console.py", line 23, in run
      exec(code, {'__name__': '__main__'})
    File "main.py", line 9, in &lt;module&gt;
      r = requests.get('https://github.com/')
    File "P:\Anaconda3\lib\site-packages\requests\api.py", line 75, in get
      return request('get', url, params=params, **kwargs)
    File "P:\Anaconda3\lib\site-packages\requests\api.py", line 60, in request
      return session.request(method=method, url=url, **kwargs)
    File "P:\Anaconda3\lib\site-packages\requests\sessions.py", line 533, in request
      resp = self.send(prep, **send_kwargs)
    File "P:\Anaconda3\lib\site-packages\requests\sessions.py", line 646, in send
      r = adapter.send(request, **kwargs)
    File "P:\Anaconda3\lib\site-packages\requests\adapters.py", line 514, in send
      raise SSLError(e, request=request)
  requests.exceptions.SSLError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded
  with url: / (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
  </code></pre></li>
  </ol>
  
  <p>After digging through related issues it seems the problem is that some DLLs are not copied into the build-folder of the application, such that these files cannot be found by the application. What I tried without positive result:</p>
  
  <ol>
  <li>Played with the <code>includes</code> and <code>packages</code> options in the setup script to include certain packages (as describe <a href="https://stackoverflow.com/a/53323828/11011452">here</a>)</li>
  <li>Manually copied <code>libssl</code> and <code>libcrypto</code> to the build-folder (as described <a href="https://stackoverflow.com/a/53333922/11011452">here</a> and <a href="https://github.com/conda/conda/issues/8273" rel="nofollow noreferrer">here</a>)</li>
  <li>Copied the same files via the <code>include_files</code> option in the setup script</li>
  <li>Added <code>(requests.certs.where(),'cacert.pem')</code> to <code>include_files</code> and <code>os.environ["REQUESTS_CA_BUNDLE"] = os.path.join(os.getcwd(), "cacert.pem")</code> to <code>setup.py</code> as described <a href="https://stackoverflow.com/a/15224335/11011452">here</a> and <a href="https://stackoverflow.com/a/25239701/11011452">here</a></li>
  </ol>
  
  <p>Does anyone know how to avoid this issue? Does anyone know how to find out which files exactly are missing, such that they can be copied to the application folder? I ran into the same problem with other packages, not only <code>requests</code>.</p>