Versions
OS: OSX Sierra
Python: 3.5
What am I trying to achieve?
I'm trying to import krakenex and run it with cmd + b in Sublime Text 3 on OSX.
What do I expect to happen?
I expect to be able to run the example open-positions.py (or any other).
What happens instead?
When pressing cmd + b, I get
"import krakenex
ImportError: No module named krakenex"
If I create a new file that just says "print 'hello world'" and then press cmd + b, it does print 'hello world'.
However, krakenex is not imported when I press cmd + b within open-positions.py.
The problem is probably very basic. I learned python the day before yesterday, installed Anaconda yesterday, and I have very little experience with APIs. Apologies for the incompetence.
I downloaded the zip file from https://github.com/veox/python3-krakenex/, extracted it, then ran
python3 setup.py install within that extracted directory.
I then opened that whole extracted folder with Sublime Text 3.
Then, within open-positions.py, if I press cmd + b, I get said error message.
The full output is
raceback (most recent call last):
File "/Users/Norbert/Downloads/python3-krakenex-master/examples/open-positions.py", line 1, in
import krakenex
ImportError: No module named krakenex
[Finished in 0.1s with exit code 1]
[shell_cmd: "python" -u "/Users/Norbert/Downloads/python3-krakenex-master/examples/open-positions.py"]
[dir: /Users/Norbert/Downloads/python3-krakenex-master/examples]
[path: /usr/bin:/bin:/usr/sbin:/sbin]
Much appreciated.
解决方案If I create a new file that just says print 'hello world' and then press cmd + b, it does print hello world.
Here is your problem. See, your program is written in Python 2. Had you run it in Python 3, it would say SyntaxError: Missing parentheses in call to 'print'.
You've installed that module into your python3 and are running python2 from ST3.