3

I just installed QGIS (2.18) using the OSGeo4W-installer (64-bit). When I use the python-console in QGIS it is possible to run the 'import numpy' statement and to use numpy.

When I open python in the command-window of windows or when I create a stand-alone script it is impossible to import numpy. It gives this:

 ImportError: No module named _ctypes

This is strange because it is the same installation of python and ctypes is installed during the installation of QGIS. Any ideas how to get numpy working in standalone scripts?

Some additional information: I used the default installation of the OSGeo4W installer and my pythonpath is set to:

 C:\OSGeo4W64\apps\Python27\Lib

and python is added to the path-variable:

 C:\OSGeo4W64\bin
4
  • Does it work when you use OSGeo4W Shell command window?
    – Joseph
    Commented Jan 25, 2017 at 15:28
  • Yes, I just tested it and it works.
    – da_re
    Commented Jan 25, 2017 at 15:34
  • But I want to get it work in a stand-alone script, I need python outside the shell...Any ideas? :)
    – da_re
    Commented Jan 26, 2017 at 8:52
  • If it works with the shell you can also import os with python and do os.system("your_command") Commented Jan 27, 2017 at 9:44

1 Answer 1

1

The problem is solved. I added the location of _ctypes.pyd to the systemvariable pythonpath and now it works perfectly!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.