I want to try out PyCharm for sage mathematics development. Normally I run eclipse to do sage development, but now I want to try it with PyCharm.
To launch eclipse with sage environment variables, in command line I normally do the following:
sage -sh
cd /path/to/eclipse
./eclipse
The first line loads the sage environment variables, the remainder launches eclipse. How can I do the same thing for pyCharm? (note I am using a Mac and Ubuntu for sage development; the commands above are agnostic to both OSes)
Start Pycharm using the pycharm.sh cmd from anywhere on the terminal or start the pycharm.sh located under bin folder of the pycharm artifact. 2. Once the Pycharm application loads, navigate to tools menu and select “Create Desktop Entry..” 3. Check the box if you want the launcher for all users.
From the main menu, select View | Tool Windows | Terminal or press Alt+F12 .
To run PyCharm from the shell, use the open command with the following options: -a : specify the application. --args : specify additional arguments when passing more than just the file or directory to open. -n : open a new instance of the application even if one is already running.
Edit (April 2020): It seems that launcher script creation is now managed in Toolbox App settings. See the Toolbox App announcement for more details.
--
Create Command-line Launcher
/usr/local/bin/charm
$ charm YOUR_FOLDER_OR_FILE
Maybe this is what you need.
Inside the IDE, you can click in:
Tools/Create Command-line Launcher...
You're right that the JetBrains help page isn't very clear. On OS X, you'll want to use the launcher at:
/Applications/PyCharm.app/Contents/MacOS/pycharm
Or, for community edition:
/Applications/PyCharm\ CE.app/Contents/MacOS/pycharm
Unfortunately, adding a symlink to this binary wouldn't work for me (the launcher would crash). Setting an alias worked, though. Add this in your .bash_profile
(or whatever shell you use):
alias pycharm="/Applications/PyCharm CE.app/Contents/MacOS/pycharm"
Then, you can run commands with simply pycharm
.
With this you can do things like open a project:
pycharm ~/repos/my-project
Or open a specific line of a file in a project:
pycharm ~/repos/my-project --line 42 ~/repos/my-project/script.py
Or view the diff of two files (they don't need to be part of a project):
pycharm ~/some_file.txt ~/Downloads/some_other_file.txt
Note that I needed to pass absolute paths to those files or PyCharm couldn't find them..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With