How can I add a Python version to the Python Launcher? - python

On Windows, how can I add a Python version to the Python Launcher? I have python 3.7 installed alongside 2.7. I've made sure that the PATH variable and the registry keys are correct. One thing I will say is that I can't see any other Python environment variables on my machine (such as PYTHONPATH), or either of the py.ini files descibed here.
If possible, I would like the solution to also work with python distribition, such as Anaconda.
This is the same question as py launcher does not find my Python 2.7, but none of the answers worked for me, so I trust I am allowed to ask again.
related:
How should I set the default Python version in Windows

I solved the problem by going to Control Panel -> Uninstall A Program, right clicking on "Python 2.7.15", clicking "change", and pressing "repair". No clue why I didn't try that first.

Related

How do I reset the python build system in Sublime Text 3 on WIndows 10?

I've deinstalled and reinstalled a bunch of Python Versions and edited my system variables in order to clean up the quagmire of pip not being able to install packages to the right locations. Long story short: Sublime now can't find numpy (or any 3rd party module), because it somehow figured that the python 2.3 version that comes with ChemDraw is the one I really want to use, not the 3.9 version I had used previously.
I've tried a bunch of tutorials online (such as resetting everything to factory settings) however nothing seems to unlink the python build system from that python 2.3 version that came with ChemDraw. Even deinstalling everything and installing Sublime 4 keeps that association. Like...how?
So here's my problem: My build system for python is linked to the wrong python version and I don't know how to link it to the python 3.9 that's located in AppData/Programs.
How can I associate the python.exe of python 3.9 in AppData with my python Build System instead of the current python 2.3, which is located ProgramFiles?
Ok, so the problem was that there was a system variable called PYTHONPATH, which I don't remember setting. It seems that Chemdraw, if installed with ChemScript, installs it's own python installation, which is 2.X.
That python install seems to set its own system variable called PYTHONPATH, which Sublime seems to prioritize for it's default python build system.
Delete whatever incorrect path is set in PYTHONPATH and paste the following into it instead:
C:...\Python\Python39\Scripts;C:...\Python\Python39;C:...\Python\Launcher;

Getting Pip working in PyCharm on MacOS 10.14.5

I'm a python noob working through this intro to python: https://www.youtube.com/watch?v=rfscVS0vtbw. (definitely no need to watch this. Just adding it as context)
It's been going really well, except now I'm up to the part where I need to use pip, and despite having downloaded version 3.8 of Python, it keeps telling me that it doesn't even have pip installed.
I'm wondering if anyone could walk me through what the issue might be and how to actually start using pip in PyCharm.
I've tried downloading pip and installing it but even that doesn't seem to work. If anyone has an ultra-hand-holdy solution (very much for a noob) that would be appreciated.
I feel like the problem might be that I'm putting things in the wrong directories or something? Obviously there are some built-in versions on Python (2.x) already on the Mac so maybe they are interfering?
Thanks in advance for your help.
If I recall correctly, the version of Python that is used when you use the command python is the 2.x version, which doesn't have pip. So if you want to use python in terminal, you should call it as python3 and pip3 for using the pip command.
If you want to set a different Python version as the default one, you can do that. Here is a tutorial that can get you started with that (there's a plethora of other tutorials if this one isn't clear enough): https://opensource.com/article/19/5/python-3-default-mac
For using PyCharm specifically, you can setup the Python interpreter that is used with PyCharm by going to Preferences(or Settings) -> Project:[name of your project] -> Project Interpreter and then chose the desired Python Interpreter from the drop down menu. You can also create a virtual environment there by clicking on the cog icon and choosing Add. This is the preferred way and very convenient to keep installed packages local to your project. After you're done with that, open up PyCharms terminal (at the bottom of your PyCharm window) and you should be able to normally use pip with the command pip.
Alternatively, you can install Python packages in PyCharm using their built in package manager that you can find in the same window where you set your Python Interpreter. Below the dropdown menu you'll see a + sign, where you can click to add packages.

Updating Python 3.4x to 3.5

just a quick question. I have Python 2.7 on my mac by default. I have also installed 3.4 and use it more than 2.7, but would like to upgrade to the new 3.5. Should I remove 3.4 and just lay down a new install of 3.5, or is there a way to just update it. All my searches just talk about upgrading from 2.7 to 3x. I am just concerned about messing one of the installs up. Any input would be greatly appreciated.
Cheers.
It is a lot safer to change your environment so that Python 3.5 is given preference over the default Python.
There are many ways to do this; if you do them all, it provides the maximum compatibility.
You can set these in your .bash_profile file, which is a hidden file in your home directory.
You can set the PATH environment variable so that Python 3.5 appears first in the search order; like this PATH='/path/to/your/python3.5/directory':$PATH
You can set a local alias in your shell, so that the python command points to Python 3.5, like this alias python="/path/to/the/file/python3.5"
Once you set the above, make sure you restart the terminal application.
If you download the installer form python.org; it will set these environment variables for you.
Also, if you use a utility like brew it will set the shell up correctly for you.
This will ensure that the shell environment will point to version of Python you want; however this does not affect applications that run on the desktop as most of them don't read the shell environment variables.
So, if you are using and IDE like PyCharm you'll still have to manually set the correct Python version for your projects.
This may seem like a lot of workaround, but on most Linux systems and even on OSX, Python is a core part of the system and it is used by some utilities, therefore it is always dangerous to rip and replace the version of Python that came with the operating system.

System Python conflict between Anaconda and existing Python installation

I've been going with a basic Python3.4 install that I've been installing many modules into for over the past month but have reached a point where pip is coming up short and I'm going to just install the full Anaconda on my system to go deeper into bokeh-server stuff.
I get a popup during the Windows 64bit installer (Anaconda3-2.3.0-Windows-x86_64.exe) saying
A version of Python 3.4 (64-bit) is already at C:\Python34\ We
recommend that if you want Anaconda registered as your system Python,
you unregister this Python first. If you really know this is what you
want, click OK, otherwise click cancel to continue.
Didn't find much documentation on this subject, and I'm not really sure how to "unregister" that installation of Python apart from uninstalling it entirely from Windows which I imagine would accomplish such a thing. Is this basically telling me to check how my Python Launcher for Windows is setup after the Anaconda installation? I'm completely unfamiliar with this notion of python system registration? Is that just a round about warning about which python version takes precedence on the system path, or which installation holds the file associations?
The solution is simply to uninstall python (for example, run the original python installer and select the uninstall option). The python key in the windows registry will be removed (which is what unregister means in this context).
Here is a link to a script that will unregister a Python installation (if you haven't come across it already). I personally have not dealt with anything like this. It seems like it should work, but you may have to tinker around with some of the paths in the script to get things to work. The links in #nightuser 's post will also probably fix the issue.
Why not just remove your version of Python? You could do a pip freeze > requirements.txt with your current Python and add them to Anaconda, or create an environment with Anaconda using those packages. Anaconda has greatly decreased the amount of time I spend setting things up.
You are getting that prompt because you have another version already installed the safe way to do this is going to the directory of the existing version and running the uninstaller. Once the previous version is completely uninstalled. You can run the installation as normal it should works!
enter image description hereYou have already installed python in your environment, so your system can handle your python code. Anaconda can handle your python code as well. If you install Anaconda and expect use python provided by Anaconda, then your system will confuse about assigning the code job. To avoid this confusion, there is always a path to point out which python you want.
You can ask your OS to find specific python by changing your environment path in windows OS:
By deleting the python path your Python will be invisible. Changing path is more convenient compared with the uninstall.
If you got a python compiling software like Pycharm, things are different. Pycharm may have python3.6 while your system got python 3.5. You need to delete path in those software or uninstall python specified by those software.
Pycharm
Actually, instead of registering the Anaconda as the system python, you can install it first, then specify your Pycharm and system path to the Anaconda python path. Thus, your Pycharm will use python provided by Anaconda and package & virtual environment you need.
I edit this for lots of times because I got Great wall, so I can't close something pop up in my screen(cause it is Blank). And everything is missing if I refresh. This is annoying.
My system path Anaconda3's python36
Add path in Pycharm
Or you can't use these packages and Anacon's virtual Environment

Using pydev with Eclipse on OSX

I setup PyDev with this path for the python interpreter
/System/Library/Frameworks/Python.framework/Versions/2.5/Python
since the one under /usr/bin were alias and Eclipse won't select it. I can run my python script now but cannot run the shell as an external tool. The message I get is
variable references empty selection ${resource_loc}
Same if I use {container_loc}
Any thoughts ?
Sunit
I installed the Python.org version as well, this is a must.
I finally got PyDev working in Eclipse by pointing the interpreter to:
/Library/Frameworks/Python.framework/Versions/2.6/bin/python
manually. If you don't do it manually (by using the Autoconfig) it seems to not find the right version.
Common practice seems to be to install an up-to-date Python 2.5 from python.org and use that instead of the system installation. I saw that recommended here and there when I got started on Mac OS X.
It installs under /Library (as opposed to /System/Library) so the system Python is intact. Pydev has /Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python as its configured Python interpreter and all is well.
Can't state for sure that your trouble is due only to using the system's Python installation; in any case this way I have no trouble. Also, this way when you fiddle with your development environment (install things in site-packages, upgrade Python), anything that uses the system Python is sure to be unaffected.
I know this is a ancient post... but, in case of some newbee like me to get the better answer.
I just using "Eclipse Marketplace" from the "Help" menu and search for keyword "python" or "PyDev" to get PyDev, and get it successfully installed.
AND, you should add PyDev to the top-right dock.
For the instance, my eclipse on my laptop's OSX is (Version: Indigo Service Release 2 Build id: 20120216-1857).
Have fun, folks! :)
I believe ${resource_loc} or ${container_loc} (without any argument) are based on the current selection in your workbench when you are launching your script.
So are you selecting the right resource when selecting that script through the "external tool" runner ?
At least, click on the project name before you run one of the external programs.
Note: it works with a selection in the Navigator or Package Explorers views (the latest might not be available in PyDev environment though)

Categories

Resources