Changing PyScripter to work with different Python Versions - python

I'm using PyScripter for writing python programs and I can't figure out how to make it work with Python26 on my computer. When I installed ArcGIS, by default it installs Python26. I then installed PyScripter which found that installation and it worked fine. Later, I installed Python27, and subsequently reinstalled PyScripter.Now Pyscripter uses Python27 and I don't know how to change it.
I've looked at the settings under Tools -> PythonPath and they are as follows:
and also Tools -> Configure Tools
I assume I need to change the python path entries, but what do I change them to? My Python26 installation is found in C:\Program Files (x86)\ArcGIS\Desktop10.0\Bin.

If you go to the pyScripter folder in the start menu, it will have a version of pyScripter for Python 2.4 to 3.2. Just run the one corresponding to your Python version.

go to the pyscripter shortcut : right click then select Properties,
add the option to the target : --PYTHONXX
wherein XX the Python version.
ex : "C:\Program Files\PyScripter\PyScripter.exe" --PYTHON24
Copy/paste another shortcut and modify the option to another python version.

Easiest way to change the python version in PyScripter is:
Run->Python Version-> Setup Python Versions->Add New Python Version->
Browse to your python exe and select ok.-> Click on Activate Selected Python Version..
Now restart your PyScriptor and your are good to go.

Related

IDLE and PyCharm are using different versions of python, despite the python.exe PyCharm is using being installed in the same directory

I cloned a python environment and recreated it on a new machine using Anaconda Navigator with a yml file. My script runs fine in the new environment using PyCharm. The python version of this environment is 3.9.0. However the script doesn't run with IDLE because IDLE is running version 3.11.0.
IDLE is located at:
C:\ProgramData\Anaconda3\envs\CloneETL3\Lib\idlelib\idle.pat
The python interpreter which PyCharm uses is located at
C:\ProgramData\Anaconda3\envs\CloneETL3\python.exe
How can IDLE have a different version from the python interpreter when they were just installed fresh? How can I prevent multiple versions of python from running on my machine? I made sure to create a new project in PyCharm, use an existing interpreter using conda and point it to the exe I described above.
The environment was first created from a clone of my ArcGIS Pro environment.
Thanks for the help!
This is quite common in most editors. I use vscode which is similar to pycharm and the user can select the version of python (or other languages) that they wish to run.
It look like this:
The reason for this is that some users have the requirement of being compatible with previous versions. You should be able to select the latest version of each.
Alternatively you can delete all versions leaving only the one version that you desire, this would avoid confusion...
You could refer to this answer for that option: How to completely remove Python from a Windows machine?

How can I set the latest python interpreter

I have many python versions installed. I need nevertheless that when using VSC the script be run by python3.10.7. I changed accordingly the interpreter in VSC to the latest python version. The latest python version, python3.10.7, is installed in the folder /user/bin, while the one which I get with which python is installed in a different folder, home/myname/anaconda3/bin/python. I will appreciate your help. I use Ubuntu 20.4. I do not have experience in using virtual environments. How do I change the interpreter to the latest one ? Thanks for your help.
you can do it by opening the Command Palette using Ctrl+Shift+P and enter Preferences: Open User Settings. Then set python.defaultInterpreterPath, which is in the Python extension section of User Settings, with the appropriate interpreter.

How to completely uninstall Python 2.7 from Windows 7 PC

Having installed Python 2.7 from here:
https://www.python.org/downloads/release/python-279/
I then uninstalled it using the control panel (I have Windows 7 pro). Now Python 2.7 no longer appears in the list of installed programs, however the files are still sitting in the same place on the C: drive.
I have since installed version 2.6 but I seem to be having some clashing issues between the versions. I'm having similar issues to this guy:
How to completely remove Python from a Windows machine?
I just want to know how can I remove Python 2.7 completely?
Will simply deleting the folders from my C: drive be sufficient?
How can I test that it has been completely removed?
You should just be able to delete the local files if you've already uninstalled from control panel. Also be sure to go to your environment variables and make sure that the python 2.7 directory isn't there. To do that,
Go to the start menu and right click on Computer
Click on Properties
Advanced system settings
Environment Variables and look for "path" under system variables
Be sure to erase C:\...\Python2.7.x
If you uninstalled from control panel it might not be there but it's probably good to double check. Also, be sure to delete the ; before C:\...\Python2.7.x
I had a similar problem. I kept installing Python 3.6 but when I typed "python" from the command prompt, Python 2.7 kept opening up despite the fact that I had uninstalled and it wasn't in my Path or in my Programs folder. I eventually solved the problem by uninstalling Enthought/Canopy from my computer and also erasing all the related files. Now I have a regular installation of Python 3.6 working and accessible from the command prompt. I assume I could now also get a parallel python 2.7 going, but I haven't tried to since I have no need for it at the moment.
The giveaway for me that my python 2.7 installation was strange was that when I typed:
python --version
into the command prompt, I was getting the following:
Python 2.7.6 -- CUSTOM

Python OpenGL in Eclipse/Aptana

I am trying to import the OpenGL.GL module.
Given the py file with that line, I can perform "python file.py" just fine, but I cannot run that same file when used in Aptana or Eclipse. Both IDEs have PyDev installed.
I do have PyOpenGL installed.
I wish to point out that I can still import other modules (PIL, numpy), which were installed the same way as the PyOpenGL. I am confident that there is only 1 python running on my MacOS.
I had the same problem after installing a different version of PyOpen and my Eclipse PyDev path is messed up. What I did was remove the interpreter link and re-added the old one which made PyDev to re-scan my libs. This seems to fix the problem. Don't forget for all your projects, you need to go to the property (Right click project->properties) and re-select the interpreter.
Maybe you need to reconfigure your interpreter.
If you installed PyOpenGL as an egg after pydev was set up your PYTHONPATH might be out of date.
Check out Preferences->PyDev->Interpreter - Python
Are you sure you don't have multiple versions of python? Seems to me like the interpreter that aptana uses is not the same as the one used from command line. You can look in:
Run -> Run configurations -> Python run -- then you have Interpreter tab
There you can click : See resulting command line. Than will get you the python that is used as well as the python path

IDE don't see all the functions

i'm using Elcipse+PyDev and Pyscripter sometimes for Python 2.7
Yesterday i installed PyTables from compiled binaries and :
import tables
h5f = tables.openFile(r'D:\sample.h5','w')
h5f.createGroup('/','Box')
h5f.
So, when I type "h5f." IDE don't show me all the methods, only a few!
Can't do anything with It, installed PyTables few times,same result...
Method h5f.CreateGroup() works perfectly, but IDE dont see it so don't display it in drop-down list! Eclipse and Python both behave same...
The thing with Pydev and Eclipse is that when you install a new package or library and if you want to use the auto-complete with it, you will have to recreate the system PYTHONPATH in eclipse.
For that go to: Window -> Preferences -> Pydev -> Interpreted Python and in the tab libraries, in System PYTHONPATH you will not see your new installed library because pydev just do a copy of the PYTHONPATH the first time that you have configured and now each time you installed a new package you will have to resynchronize pydev with the new PYTHONPATH.
So to resynchronize you will have to click on the button Apply so that eclipse export (again) all the library (between them your new installed one) from PYTHONPATH to eclipse.
So now eclipse should know your library and you should work with it just fine.
Hope this will help :)

Categories