

Among them the most important one is SAGE_ROOT=/usr Gives the list of all more or less needed variables. In my case: (sage-sh) :~$ printenv | fgrep SAGE sage -sh sets all needed variables for the operating system. In 38750 the procedure was described for a linux machine. The "answer" is possibly not the solution, but i need space to insert information, a comment is not enough. To get that all working might be a little bit tricky, and I think should be tackled as a separate question. But you should be able to from sage.all import * and use Sage objects in plain Python. sage files, nor is it aware of Sage syntax.
#Pycharm windows how to#
Then things "just worked".īe aware that this is still just the normal Python interpreter, not the Sage interpreter, so it doesn't know how to run.


But I found it simpler to just set the environment variables permanently in my environment. This is actually what I did initially-I set Path, as well as SAGE_ROOT etc. You can configure environment variables in the "Run" configurations, and then again (separately, unfortunately) in the settings for the Console. Then when you start a new project, make sure to select the Sage Python as the default interpreter (you might be able to use it with a virtualenv as well but I haven't tried that-if you do make sure it inherits system site-packages, or else you don't get Sage, etc.) In general I don't think it's necessary:įinally, P圜harm also allows you to set environment variables to run the interpreter with on a per-project basis in a couple differentl places. If this does happen you can still proceed with adding that interpreter, but it won't work until you set the necessary environment variables. Otherwise the interpreter executable can't even start.
#Pycharm windows windows#
This is because Windows uses the Path environment variable to search for DLLs, and the correct paths need to be added in order to find the Cygwin DLL, among others. If you didn't set the Path environment variable correctly, then you'll get an error here (it might show "Permission error" or something like that). If you set up the correct environment variables, P圜harm should be able to successfully execute Sage's Python interpreter, and also populate the list of packages installed for that interpreter, and you'll see something like this: Then from the list of interpreter types, select "System Interpreter":īrowse to the python2.7.exe executable under C:\Program Files\SageMath 8.1\runtime\opt\sagemath-8.1\local\bin (or you can just copy this path directly into the file browser): You might have something different shown here for an already existing interpreter.Ĭlick the little gear icon in the top-right corner next to the drop-down list of available interpreters, and select "Add Local" from the menu. In the settings page select "Project Intepreter"-this is where you can add additional interpreters for use across projects. From the Welcome screen click on the little "Configure" gear and select "Settings" from the menu: Then we need to correctly add Sage's Python interpreter to P圜harm's list of available interpreters. There are likely some others that should be set as well, but that was the bare minimum I found necessary to get Sage's Python interpreter working happily in P圜harm. The console commands to set the necessary variables are: setx Path "%Path% C:\Program Files\SageMath 8.1\runtime\opt\sagemath-8.1\local\lib C:\Program Files\SageMath 8.1\runtime\opt\sagemath-8.1\local\bin C:\Program Files\SageMath 8.1\runtime\bin C:\Program Files\SageMath 8.1\runtime\lib\lapack" This can be done through a GUI in Windows, or via the cmd console. The easiest way I found to go about this is to first set some permanent environment variables in your Windows environment.
