aliteralmind
aliteralmind

Reputation: 20163

Windows 7 Python installation: Works with full command, but "file.py --version" returns "Could not load Python dll"

This is a followup to this question: The *only* way to successfully execute Django python command is with "python ...PATH...django-admin.py [options]". Why can't it be reduced?

I can successfully run a command, say django-admin.py, as long as I prefix it with both python and the fully-qualified path to the py file. For example, this works fine:

python c:\applications\programming\python_341\Scripts\django-admin.py startproject mysite

But none of the following work (see the previous question for specific responses):

Most concerning is when I run, as suggested, this:

django-admin.py --version

It responds with

Could not load Python dll

I honestly don't know what it's supposed to respond with, but I'm guessing this ain't it.

I've uninstalled, restarted my computer, and reinstalled Python (as well as everything listed by pip freeze) three times today.

Is this something I need to worry about? What can I do to fix it?

FYI: Starting the Python shell prints this at the top:

Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600 32 bit (Intel)] on win32


Updated PATH, after following @Bo102010's suggestion:

C:\applications\programming\python_341\DLLs;
C:\applications\programming\python_341\;
C:\applications\programming\python_341\Scripts;
C:\applications\programming\;
.;
C:\Program Files\Common Files\ArcSoft\Bin;
C:\Program Files\Common Files\Microsoft Shared\Windows Live;
C:\Program Files\Windows Live\Shared;
C:\Windows;
C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\Windows\system32;
C:\applications\programming\apache-ant-1.8.1\bin;
C:\applications\programming\apache-maven-3.1.1\bin;
C:\applications\programming\jdk_7_51\bin;
C:\applications\video\quicktime\QTSystem\;
C:\Program Files\TortoiseSVN\bin;
C:\applications\programming\apache-maven-3.2.2\bin;
C:\applications\utilities\gpg4win\pub

If you search your drives for django-admin.py do you just find the one? – Bo102010

C:\applications\programming\python_341\Scripts\django-admin.py (this is the one on the PATH. This one has a windows path in the source code, the other has a unix/linux path):

#!C:\applications\programming\python_341\python.exe
from django.core import management

if __name__ == "__main__":
    management.execute_from_command_line()

C:\applications\programming\python_341\Lib\site-packages\django\bin\django-admin.py:

#!/usr/bin/env python
from django.core import management

if __name__ == "__main__":
    management.execute_from_command_line()

I confirmed that both of these files are installed by Django. I uninstalled and both disappeared.

Upvotes: 0

Views: 196

Answers (1)

bbayles
bbayles

Reputation: 4507

The Could not load Python dll message is coming from the Take Command Console shell.

It seems that it doesn't respect the Windows file associations for .py files.

For future people who have this problem:

  1. Try using cmd.exe instead of TCC, if you're using TCC
  2. Make sure Windows has the right file associations for .py files. For Windows Vista+ try using Default Programs Editor to verify.

Upvotes: 1

Related Questions