I installed anaconda from the official website and I want to integrate it with sublime text 3. I tried to build a sublime-build json file like this:
{
"cmd": ["C:/Users/Minh Duy/anaconda3/python.exe", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}
But I got errors:
C:\Users\Minh Duy\anaconda3\lib\site-packages\numpy\__init__.py:138: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
from . import _distributor_init
Traceback (most recent call last):
File "C:\Users\Minh Duy\anaconda3\lib\site-packages\numpy\core\__init__.py", line 22, in <module>
from . import multiarray
File "C:\Users\Minh Duy\anaconda3\lib\site-packages\numpy\core\multiarray.py", line 12, in <module>
from . import overrides
File "C:\Users\Minh Duy\anaconda3\lib\site-packages\numpy\core\overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Minh Duy\Documents\Self-study\Python\Exercise\test_code.py", line 1, in <module>
import numpy as np
File "C:\Users\Minh Duy\anaconda3\lib\site-packages\numpy\__init__.py", line 140, in <module>
from . import core
File "C:\Users\Minh Duy\anaconda3\lib\site-packages\numpy\core\__init__.py", line 48, in <module>
raise ImportError(msg)
ImportError:
I didn't add anaconda to PATH, but everything works fine on spyder and anaconda prompt. I don't really know if there is anything wrong with the way I set up anaconda or something else. Can someone help me with this issue?
The DLLs of the mkl-service that it's tried to load are by default located in the following directory:
C:/Users/<username>/anaconda3/Library/bin
since that path isn't in the PATH Environment Variable, it can't find them and raises the ImportError. To fix this, you can:
This isn't the best method, as it makes this directory available globally, while you need it only when you are building with Anaconda.
{
"cmd": ["C:/Users/<username>/anaconda3/python.exe", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
"env": {
"PYTHONIOENCODING": "utf-8",
"PATH": "$PATH;C:/Users/<username>/anaconda3/Library/bin"},
}
This should work, however, to make it more error resistant you should consider adding some other paths too:
Press Shift+Control+P to open command palette inside Sublime Text, search for Conda and click to install; once installed, change the build system to Conda from Menu -> Tools -> Build System. Then you can open the command palette and use the commands that start with Conda to manage your Anaconda Environments.
Note that you need to activate an environment before using Ctrl+B to build.
first configure it with python. write python in your cmd to get python path. then configure it with anaconda.
{
"cmd": ["C:/Users/usr_name/AppData/Local/Programs/Python/Python37-32/python.exe", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.