Python virtualenv with Anaconda and python.org python 3.5 - python-3.x

I have both anaconda Python 3.5 and Python 3.5 from python.org (on windows)
python -V
Python 3.5.1 :: Anaconda 4.0.0 (64-bit)
python3 -V
Python 3.5.1
py -V
Python 2.7.12
I want to create a virtualenv with only python 3.5.1 and not the anaconda version.
When I run
python3 c:\Python35\Tools\scripts\pyvenv.py venv
python -V still shows Python 3.5.1 :: Anaconda 4.0.0 (64-bit) after activating the environment
Is there anyway to get it to use the native 3.5 version?

You can use command line option -p during venv creation to force a particular interpreter to be used with it.
python3 c:\Python35\Tools\scripts\pyvenv.py -p python3 venv
Edited:
My bad, wrong virtual environment. As I can see you use venv from standard library and it's impossible to choose particular interpreter during virtual environment creation. On the other hand python3 -m venv venv command should use python3 interpreter for virtual environment which is one without anaconda in your case.
Edited 2:
I've just checked on windows:
C:\Users\usr>where python
C:\Python35\python.exe
C:\Users\usr\Anaconda3\python.exe
C:\Users\usr>C:\Users\usr\Anaconda3\python.exe --version
Python 3.5.2 :: Anaconda 4.1.1 (32-bit)
C:\Users\usr>C:\Users\usr\Anaconda3\python.exe -m venv myanacondavenv
C:\Users\usr>myanacondavenv\Scripts\activate.bat
(myanacondavenv) C:\Users\usr>python --version
Python 3.5.2 :: Anaconda 4.1.1 (32-bit)
(myanacondavenv) C:\Users\usr>deactivate
C:\Users\usr>C:\Python35\python.exe -m venv myvanilaenv
C:\Users\usr>myvanilaenv\Scripts\activate.bat
(myvanilaenv) C:\Users\usr>python --version
Python 3.5.1
(myvanilaenv) C:\Users\usr>deactivate
C:\Users\usr>
Reference

Related

Cannot update python version in ubuntu after installing it

I want to update python version from 3.6.1 to 3.7. What I did is installing python 3.7 and alternating the version for python3 via sudo update-alternatives --config python3. It was found that there are multiple versions (I also installed version 3.8):
There are 2 choices for the alternative python3 (providing /usr/bin/python3).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/python3.7 2 auto mode
1 /usr/bin/python3.7 2 manual mode
2 /usr/bin/python3.8 1 manual mode
(I am not sure why there isn't 3.6.1 on the list)
After alternating the version, when I type python --version, the terminal still shows version 3.6.1:
Python 3.6.1 :: Anaconda 4.4.0 (64-bit)
After several times of trying I am still not able to update my python version. It seems that it relates to Anaconda issue, but after searching the internet I still found no solution. What should I do?
I am using ubuntu 20.04.
I think using this command in your terminal would answer your question :D
which python
I am guessing you are under the environment of conda where python 3.6.1 is installed and its evident that you have already installed python 3.7 in your system environment (not anaconda env)
Try :
conda deactivate
python --version
Your system wide installation of python environment is totally different from your anaconda environment
if you want to upgrade from python 3.6.1 to python 3.7 inside anaconda use the follwing in when you are in an active conda environment for ex inside base:
conda install -c anaconda python=3.7
Its better to make a new environment in conda by :
conda create --name ENVNAME python=3.7
If you don't want to use the anaconda environment by default remove it from your bashrc.

How to make a python version as default version in ubuntu

Am using ubuntu 20.04 ,I have two versions of python installed 3.8.5 and 3.8.2. How to make Python 3.8.2 as the default version for python3
$ python3 -V
Python 3.8.5
$ python3.8 -V
Python 3.8.2

upgrading python in Conda environment

I have python 2.7 installed on my Mac. I installed python 3.8.3 in an anaconda environment. However, when I type the command:
python --version
in the environment I still get python 2.7. how can I make my main python version 3.8.3 in this environment without completely getting rid of python 2.7

How to install modules in Python 2.7 insted of Python 3.6?

I have two versions of Python in my laptop. Python 2.7 and Python 3.6. If install a module this is installed only in Python 3.6.
I would like to install modules in Python 2.7 through pip but I don't know how to do it.
I want to install right now GDAL and Fiona for Python 2.7 in Ubuntu 17.04.
If Python 2.7 is well installed on your system, you should have python2 and/or python2.7 commands and you could run the following:
python2.7 -m pip install <your-packages>
To make sure you are running the correct python version, you can use python2.7 --version
Better use virtual environment for this.
Follow this link https://realpython.com/blog/python/python-virtual-environments-a-primer/
You can set python version to use in virtual env using
virtualenv -p path/to/python2.7 env_name
Activate this env using . env_name/bin/activate then,
Use pip install package_name to install libraries inside virtual environment

Problems with Anaconda, Spyder and Python 3.3

I have two problems with this Anaconda distribution:
Version: 1.0.0 (node-webkit 0.10.1)
Conda Version: 3.7.4
Python Version: 2.7.9.final.0
Platform: linux-64
OS: ubuntu 14.10
1) the launcher cannot launch spyder on python 3.3 even after having create the env (IPython runs well on this env). Also launching spyder from the directory is not good from the Console. Spyder doesn't start
2) in either version 3.3 and 3.4 inside ipython and also spyder (only for the version 3.4 which runs) is not able to import pandas. Should I install in every env manually (pip install pandas)? In the default root (python 2.7) I'm able to import it

Resources