Issue
I am running my python codes vith visual studio 2019 community edition.
When I run my code with visual studio it is working fine. In Visual Studio when i run my code : C:\Users\myuser\Anaconda3\python.exe is running fine.
But when i run directly 'C:\Users\myuser\Anaconda3\python.exe' and then running that script :
exec(open("C:\Users\myuser\source\repos\PytIn\proj\code.py").read())
After that i am getting error like that:
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<string>", line 4, in <module> File "C:\Users\myuser\AppData\Roaming\Python\Python37\site-packages\pandas\__init__.py", line 17, in <module> "Unable to import required dependencies:\n" + "\n".join(missing_dependencies) ImportError: Unable to import required dependencies: numpy: DLL load failed:The specified module could not be found.
Could be any chance VisualStudio and Python.exe using different directories for loaded libraries?
Solution
Yes, Visual Studio and what you refer to as direct execution may indeed be looking in two different places for library packages. When you run python directly, or from the command line, it looks for packages in C:\Users\myuser\AppData\Roaming\Python\Python37\site-packages. When you use Visual Studio, it looks in C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Lib\site-packages. There are two possible solutions, install the packages in both places, which is redundant, but works for sure, or point your environment variables in visual studio to the AppData packages, which works until you need to update a package via your visual studio envioronment.
Answered By - netman476 Answer Checked By - Timothy Miller (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.