I am on Windows 10, attempting to get Python 3 set up so that I can use pip
to download modules and packages.
I'm able to download and install packages using python -m pip install [package]
; however, I still cannot import them into my code.
I opened IDLE, and on File -> Path Browser
I found that my path was actually looking in folders under
C:\Program Files (x86)\Microsoft Visual Studio\Shared
Not a problem - I opened up my Environment Variables
and under System variables
I added a new PYTHONPATH
, with the folder being under C:\Program Files (x86)\Python38-32\Lib\site-packages
, which is where pip
is actually installing modules and packages. This was suggested on another Stack Overflow answer over here.
This seemed to work fine - I restarted Windows, opened IDLE again and now under Path Browser
the ...\Lib\site-packages
folder is there. However, when I try to import a package I've installed, for example Numpy
, I get this mess (which I've never seen before):
>>> import numpy
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import numpy
File "C:\Program Files (x86)\Python38-32\Lib\site-packages\numpy\__init__.py", line 138, in <module>
from . import _distributor_init
File "C:\Program Files (x86)\Python38-32\Lib\site-packages\numpy\_distributor_init.py", line 26, in <module>
WinDLL(os.path.abspath(filename))
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\ctypes\__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
This happens for all of the packages that I installed with pip
. Now I'm not sure what to do.
Also, I have both Visual Studio and the newest Python 3.8 version installed on my laptop and it doesn't seem to have this issue. Anything I install with pip
is in the correct site-packages
folder and I can import it without a problem. Any advice I could have on this issue would be hugely appreciated.