VSCode terminal change from python 3.7 to 3.6 - python

I want to install dlib but since it only supports python 3.6, I have to downgrade my python 3.7.
I was able to create an environment and already selected it on my VSCode but whenever I check my terminal for the python version, it's still stuck on 3.7.
Can someone help me on this?

When you write python in the terminal, the version used is resolved by the PATH variable. You may want to specify the full path to the Python version you want (in Windows, use where python to list all possibilities), or modify the PATH variable and change the order. Depending on the installation method, the full path to python may look like C:\Python36\python.exe

Related

VScode version doesnt match latest python version on system

I have recently installed debian10 and VSCode. I have checked the currently installed version of python on my system is and it is python 3.7.3. This is also the version returned by python --version. When running python --version in terminal of vscode it returns python 3.8.8. When i go to select the python interpreter it only gives me options to select python 3.8.8. If i specify the path python i am currently using(python 3.7.3) it does not recognize it, or the other python versions there, which include python 2.7 etc. The path is /usr/bin . please help, ive been strugling with this for so long now.
Have you tried updating to the newest version of python? If not, try and it should work fine after.

How to change which Python is used when opening platformio-ide-terminal in Atom on macOS

I am trying to use the "platformio-ide-terminal" package in Atom, on macOS, to open terminals within Atom.
The issue is, the terminal in Atom does not use my Anaconda Python, and thus does not have access to packages I installed using Anaconda. Typing
which python
returns
/usr/bin/python
in platformio-ide-terminal and
/Users/.../anaconda3/bin/python
in the terminal.
Typing
which python3
in platformio-ide-terminal returns
/Users/.../anaconda3/bin/python3
I am very troubled about all these different Pythons coexisting on my computer, and a general explanation about how this works would also be very welcome.
I would also like to use the same version of Python in Atom. How can I do this?
I solved it by using IDEs rather than text editors. Pycharm offers a lot of clarity on the version of Python you are using: you can choose the exact directory with the version of Python you want to use (by setting an interpreter), and then run / debug the project from Pycharm using this version of Python. Then, I deleted other directories with unused versions of Python to save the space.

How I can delete python 3.4 if i use just anaconda python

I have a specific problem with python. I have on my ubuntu two versions python3.4 and python3.6(from anaconda). I want use just anaconda pythoncurrent version
But when i run script i have some problems with another python version
another version
How i can safe delete useless python 3.4.6?
sudo apt-get remove python3.4
anaconda should have set python3 as default python3.6 version
You should probably not delete Python3 from your system, even if you have Anaconda installed, since there might be system software that:
was not tested with subsequent versions of Python;
might struggle finding Python from Anaconda.
What you should do instead is configure your IDE / environment to run Python script with Anaconda, e.g. by setting your PATH variable to point to your anaconda/bin directory or similar.
If you are using PyCharm, as it seems from the screenshot, you could set up your project to run the Anaconda Python without modifying your other command-line settings.

Will installing Anaconda3 change Mac OS X default Python version to 3.4?

I'm planning to install Anaconda3 for Python 3.4. Since by default, Mac OS X uses Python2, will install Anaconda3 change the default Python version for the system? I don't want that to happen since Python3 can break backwards compatibility. If it does change the default Python version, how can I avoid that?
Apple has a built-in system for managing multiple versions of software, and switching between them. But you don't even need to worry about that, because Anaconda installations are self-contained: Everything lives under the top Anaconda installation directory (probably /Applications/anaconda). The only effect outside this directory is that during installation, Anaconda will offer to modify the PATH variable in your .bashrc. If you agree, it will add one line at the end of your .bashrc, something like this:
PATH="/Applications/anaconda/bin:$PATH"
As you can see, Anaconda puts itself first in the system path. This means that typing python at the shell prompt will launch python 3, which may not be what you want. I run Anaconda 3.4 like this and have had absolutely no problems with my system, but I did need to modify my own executable python2 scripts that launched python like this:
#!/usr/bin/env python
This is a nice way to find python wherever it is, but in this case it will find python 3-- oops! Changing the above to #!/usr/bin/python or to #!/usr/bin/env python2 ensures that they continue to work correctly. In my experience this was not necessary with any of the system's own scripts; everything is already set up to find the right python.
Alternative 1: You could decline the PATH modification, and use Anaconda via the launcher. In that case there is no change to the rest of your execution environment. The launcher will start a special bash prompt with the anaconda environment activated, but execution in normal shells is completely unaffected. If you will continue to program a lot in python 2, this may be for you.
Alternative 2: A minimal-impact alternative is to put the anaconda directory last in your path:
PATH="$PATH:/Applications/anaconda/bin"
This ensures that non-anaconda binaries take precedence over anaconda, so python will start good old /usr/bin/python (that is, python 2). You can start anaconda's variant by typing python3, idle3, etc. I did not have IPython before I installed anaconda, so typing ipython finds the anaconda version.
No it won't, you can have multiple python installs, once you don't remove your system python or manually change the default you will be fine.

Using two different versions of python but sqlmap needs 2.7

I've recently started using sqlmap and found out it needs python2.7. I installed 2.7 and added it to my PATH along with 3.4. My current path looks like this:
c:\Other-Programs\;c:\Python27;c:\Python34
So When I try to run sqlmap i follow these steps:
1. Open up cmd as admin
2. cd c\:sqlmap
3. python sqlmap.py
At this point, sqlmap informs me that Python 3.4 is incompatible.
I tried just doing:
3. python27 sqlmap.py
That returns an error stating that it's not a command.
Basically I want to know how I can specify the version of Python I want to use when running a command for sqlmap.
try using full path of python exe C:\Python27\python.exe sqlmap.py.
While you normally would try to do something clever with PATH definition here, a very simple solution would be to do something like this (unproven because I'm not on Windows but)
C:\Python2.7\bin\python.exe your_script_for2.7.py (make sure you are pointing to the right path of python.exe) and for 3.x
C:\Python3.x\bin\python.exe your_script_for3.x.py
What you're experiencing is probably the latest python installed, replaced the global python executable. You should be able to use python2.7 or python3.x as well though.
Me too had similar problem in windows, i was having python 3.5(and its path set in environment variables), so i installed python 2.7 from their site.then i did the following to start sqlmap
1) Got inside the folder of python 27 in cmd
2) executed the following command
python.exe "path to sqlmap-dev\sqlmap.py"

Categories