Question: How to install Pyscripter on Cygwin?
Scenerio: I have installed portable apps on a usb, then installed cygwin portable version 0.9 on it. Under cygwin, I have installed Python 2.6. I am curerntly using it with the idle IDE but I would like to use Pyscripter instead.
I can not use portable python because I need to install additional modules on python such as pyevolve and Cantera. Alternatively, maybe someone could let me know how to add these modules to portable python.
You can create virtualenv in your usb. And just switch it on in any other computer via Cygwin from our usb. It is not a way to install Pyscripter. But it is way for add modules to your portable version of python.
For anyone else trying this, note that PyScripter is intended to run under Windows, not Linux. The steps are: (1) in Windows, install a python distribution from python.org, and (2) in Windows, install PyScripter.
Note, too, that PyScripter has the desired console (interactive python interpreter) window, and a pip-based package manager that allows adding packages. For example, to add Pandas to an app, do the following:
menu: Tools menu
submenu: Tools
menu item: Install packages with pip
Package Name: pandas
The correct pandas package with required dependencies will be installed. (At least, that is what happened in my case). I was then able to import pandas into my app and use it without any problem.
Cygwin is a Linux environment that installs/runs under Windows. One of its main claims to fame is that it allows you to use Linux commands at the Windows CMD prompt. It also allows you to install/run certain Linux apps, which you then run in the Cygwin (and/or Cygwin-X graphical) environment. For example, it is possible to install/run Eric6 (a graphical Linux python IDE) under Cygwin. (I tried that, it worked - but not as great as Pyscripter)
For my money, I found that Pyscripter under Windows works great - and is much, much nicer than Eric6 under Cygwin. I am a Notepad++ user for HTML/js/PHP and started out using Anaconda (Spyder) to code in Python. PyScripter is much closer to NPP than, for e.g., Spyder or IDLE or Eric6 - and is more like what I had hoped to find in the Python world - and it simply runs under Windows like any other Windows app.
References:
https://sourceforge.net/projects/pyscripter
https://github.com/pyscripter/pyscripter
Related
I want to develop with these tools:
MS-Windows 10
Python3
gtk
PyCharm
I installed PyCharm, but up to now Python and gtk are not installed up to now.
Sub questions:
use 32 or 64 Bit version of Python?
How to install gtk for python (pip or exe)?
Use virtual env in PyCharm or use "Existing Interpreter"?
AFAIK you cant install gtk for Python on Windows with pip.
Update
I follow this guide now: https://pygobject.readthedocs.io/en/latest/getting_started.html#windows-getting-started
Update2
gtk on windows seems to be hardly used. There were many strange things, and I use pyside2 (QT) now and I am happy
use 32 or 64 Bit version of Python?
The documentation suggests 32 bit for msys2, so this is the safest. However, if you have a 64 bit computer, the 64 bit version could allow some more processing power for larger tasks.
How to install gtk for python (pip or exe)?
Most definitely using the .exe available from this source. This tool is a package manager for Windows that will let you install gtk and its dependencies. Instructions there will walk you through setting up the default environment, then from that environment run pacman -Suy and pacman -S mingw-w64-i686-gtk3 mingw-w64-i686-python2-gobject mingw-w64-i686-python3-gobject.
Use virtual env in PyCharm or use "Existing Interpreter"?
Using the 'Existing Intepreter' is a must for this method of installation, as you need to point PyCharm to your msys2 Python, which actually has gtk available. It should be located at C:\msys64\bin\python.exe. Keep in mind that you might not be able to run some scripts directly through PyCharm this way, as Python will be running through a virtual bash-like environment. Save your scripts in the C:\msys64\home\<username> directory so that you can run them easily when you open msys2 with python3 script.py.
use 32 or 64 Bit version of Python?
You can pick any, it doesn't really matter.
how to install gtk for python (pip or exe)?
You should able to install it with pip: pip install pygtk.
Use virtual env in PyCharm or use "Existing Interpreter"?
If you don't know, you probably need "Existing interpreter".
There should be an option to select path to your python.exe
It should be there: Menu->File->Settings->Project->Project Interpteter
There two ways of doing what you want.
But first, lets set something straight, when you say gtk, you don't specify GTK-2 or GTK-3. GTK-2 python bindings aka PyGTK is quite an old package (but still possible to use). GTK-3 python bindings, included in PyGobject are, I imagine, what you want.
First option
So, I'll start with the more restrictive one.
You can install PyGObject through the PyGI AllInOne installer. This is a .exe installer that comes with a lot of stuff, from gtk3 and gstreamer, to gnome applications like Glade and Gedit, to non gnome applications. Why do I say it's restrictive? It only works with Python from version 2.7+ to 3.4+ (32 or 64 bits). So if you want to use Python 3.6, you can't use this. And it seems that it will never be updated.
Second option
The other way is using MSYS2, like someone advised before. This option lets you use the current versions of Python supported by mingw-64 repository. Which I believe right now is Python 3.7.
You can install following the steps as described in the PyGObject site. Or the way explained below (CLion).
I don't know how to use PyCharm with a MSYS2 python installation, but a bit of googling led me to this tutorial for CLion. Maybe there's an analog for PyCharm.
update a couple years later, in case someone else is stumbling down this path - pyGTK/pyGObject now only installs via msys2/mwing. This causes problems with several things.
Firstly, the whole msys python is incompatible with the more normal pip way of distributing tools. From what i've seen, most python tools are shared via pip and wheels now. I'm working with a network messaging library (pynng) which is available via source and pip. I really dont want to go thru the rebuild-from-source thing. That is so last century unix mods.
Secondly, when i tried using mwing's python with pyCharm it failed, saying there were various permission errors. mwing seems to like making things restricted. Maybe if i ran pyCharm as admin it might work.
Maybe I will go with the original post's update and ditch GTK for pyside/QT. I'm not really happy with the look/feel of GTK anyway. It was just the simple solution for the rPi project I was doing.
Step 1: Download the Python 3 Installer
Open a browser window and navigate to the Download page for Windows at python.org.
Step 2: Underneath the heading at the top that says Python Releases for Windows,
click on the link for the Python 3.x.x.scroll to the bottom and select either Windows x86-64 executable installer for 64-bit or Windows x86 executable installer for 32-bit.
The difference between 32bit and 64bit:
If your system has a 32-bit processor, then you should choose the 32-bit installer.
On a 64-bit system, either installer will actually work for most purposes. The 32-bit the version will generally use less memory, but the 64-bit version performs better for applications with intensive computation.source
Step 3: For PyCharm installation follow link
Using Existing Interpreter (pre-installed python)
Step 4: Launch PyCharam, go to settings and click on project interpreter, browse path python3 installed in above step 2.
Step 5: how to install PyGTK or any library in PyCharm selected python environment. Follow step 4 and then click on green + sign in search bar just name the library you want to be installed
.
Here onwards you can install any library just follow step 5, instead of doing pip install library-name each time.
You can also use the virtual environment option, the advantage is that some libraries can work only with the specific version of python.so you can set different version of python in different virtual environments on the same machine.
virtualenv really shines when you have a number of projects and don't want them to all share the same Python installation. For example, you could have two projects with conflicting requirements. virtual environment set-up
For the latest version of PyGTK instead of Step 5 follow this link
I'm newbie of python programming.
I have windows 7 laptop and I'm also running virtual box Ubuntu.
I manually installed python3.5 on Win7 through Eclipse first. The default python version in my Virtualbox Ubuntu is 2.7.11.
Is it possible for me to install python packages through my VirtualBox to my Win7 python3.5?
Will it bring any problem with multiple versions of python.
python 3.5 packages do not work with python 2.7 and vice versa.
And I even think that you can't install packages from linux to windows.
I think what you wish to accomplish is to have a same version Python across both machine.
Best way is to go about doing it is to either install Python 2.7.x on Windows 7 or upgrade python 2.7.x on your Ubuntu to Python 3.5.x. Neither is good or bad.
To upgrade your Python 2.7.x to 3.x.x on your ubuntu machine,follow the instructions here.
If you wish to wish to install Python 2.7.x on your Windows,simply download the compatible exe from official page .It will create a folder under c: e.g. C:\Python27 .Thereafter,add the python path to environment variable PATH.
As for installing packages,the command remains the same across both OS.
pip install <package-name>
Usually packages have dedicated versions for different python versions.pip install will automatically resolve versions and install the compatible package version.
The Ubuntu VirtualBox is not just a linux-looking frontend to your existing Win7 install. It's a completely separate OS that runs as if it were on a separate computer. You can set up shared folders to share data between the host and guest, but trying to use Linux to install programs on Windows would be error-prone and risky even if you could do it.
If you plan to be using Python on Windows, you'll need to install the packages on Windows, and a Linux VirtualBox isn't going to help you with that at all. If you're uncomfortable with the Windows command line, read up on some tutorials. There are also some alternative Windows shells that provide some advantages over the built-in CMD.
If you'd rather work on Linux, you can do that, but you'd want to do it entirely inside the VirtualBox. Inside Linux, you could install the version of Python you want, install the packages you want, and use whatever dev tools you want, as if you were working on a Linux computer. (Although in this case I have to wonder why you aren't actually using a Linux computer instead of a Windows one.)
Some background: I have an intel Mac osx (running Yosemite) and use PyCharm community edition as my main IDE. I usually code in Python 3.4 however, I'm taking some MIT OCW courses which all use Python 2. To make it easier on myself when using MIT's skeleton files I have downloaded Python 2.7 and switch the PyCharm interpreter depending on my project.
Here's my question:
I'm wondering if I would run into any trouble downloading the 2.7 and 3.4 versions of Anaconda.
If this is ok, would I need to do anything special with my import commands depending on which version of Python I'm coding in?
Thanks! Happy to add clarity / more info if this isn't enough to answer my questions.
There's no danger, but it's also not the recommended way of achieving this. Rather, you should use conda, the package manager that comes with Anaconda, to create an environment for the other version of Python. For instance, if you started with Anaconda3,
conda create -n python27 python=2.7 anaconda
would create an environment called python27 in ~/anaconda/envs/python27 with Python 2.7 and all the packages from Anaconda. You would then point to ~/anaconda/bin/python or ~/anaconda/envs/python27/bin/python depending on what version of Python you want. In the terminal, use source activate python27 and source deactivate to switch between the two.
See http://conda.pydata.org/docs/ for more information on conda.
I have two versions of Python installed in my computer, Python 3.4 and Python 2.7, and I use both of these installations. When I run a script, how do I choose which versions I want to use? May I rename the names of the executables for that (Python.exe -> Python27.exe)?
Thanks.
Both python 2.7 and python 3 coexist on one machine happily.
If you name the scripts .py for those you would like to run with python 2.3 and .py3 for those that you would like to run with python3 then you can just invoke the scripts by typing their names or by double clicking. These associations are set up by default by the installer.
You can force the python version on the command line, assuming both are on the path by typing python or python3 for any script file regardless of the extension.
It is also worth looking at virtualenv for your testing.
N.B. For installing from pypi you can use pip or pip3 and the install for the appropriate version will be done.
I am using a 32-bit and a 64-bit version of Python 2.7.6 on the same Windows machine, and the solution to that was to use Winpython for the 64-bit version, which is portable.
The downside is that doubleclicking in the file manager will attempt to run a Python script with the 32-bit version (which is a non-portable installation), but I'm mostly writing and running scripts inside Spyder, and there's one version of it with each Python installation. Both have independent Pythonpaths, and have never had any problems with each other. Winpython is aimed at scientific use, though, so it may not come with all the libraries you may need.
I am guessing that I am not the only one using non-system Python 2.7.2 for scientific computations on 6.2 PUIAS Linux (RedHat)). My Python 2.7.2 is installed in the sandbox and I call it with the command python2.7. When I need to execute scripts this is not the problem. However, I would like to use ipython instead default Python shell for interactive use. I added ipython using yum? When I start it, it defaults to system python. How do I force it to load python2.7?
Thanks a bunch!
IPython is a Python package. When you have multiple Pythons, you must (generally, barring PYTHONPATH hacks) install a package for a given Python. yum would only install it for the System Python, so you must install it separately for your own Python. The solution is to simply pip install ipython with your own Python (install distribute/pip first, if you haven't).
I am going to answer my own question. For people who are using Python for scientific computing on RedHat clones (PUIAS for example) the easiest way to get all they need is to use rpm package manager and Enthought Python Distribution (EPD for short). EPD installs everything in a sandbox so system tools which are based on an obsolete version of Python are not massed up. However, paths have to be adjusted for system or even easier on the user base so that the using shell invokes non-system tools.