Python 3.X or Python 2.7 in Anaconda? - python-3.x

I have installed Anaconda on Windows 7 from the full installer and then created an Anaconda Python 3 environment (py3k) using conda. From my reading of the installation instructions at
http://continuum.io/blog/anaconda-python-3
I type activate py3k at the Anaconda command prompt to obtain that environment and in the Command Prompt window it says
[py3k] C:\users.. etc
which would appear to indicate that I am, in fact, in a Python 3.X environment. However, when I type 'Python' at the prompt I get
Python 2.7.5 | Anaconda ... etc
Am I still in a Python 3.X environment or have I omitted to do something installation-wise or otherwise?

have you tried unset PYTHONPATH, and which python?
If you do that after activating py3, you should be able to the python 3 interpreter. If not, what do you get after executing which python?

Related

Why python version is different in Pycharm interpreter and Pycharm terminal

I have installed python 3.7.9 and 3.10.1. I have one virtual environment say(test). I have set up pycharm project interpreter as 3.7.9. But in the pycharm terminal, it is showing as 3.10.1, while in the interpreter it is 3.7.9. How to make them the same?

Trying to use virtualenv with vs code, files are python 2 instead of 3 when interpreter is python3

I tried using select python interpreter and chose my virtualenv using python3 but when I use print(sys.version) on the file I create in vs code, I still get python 2.7. What am I doing wrong?

How do I set the path variables for coexistence of Python 2.7, Python 3.x and Anaconda

Having several exe's of Python, I would like to specify the command (py or python) to launch a certain version from the command line.
At the moment, I have different versions of Python (2.7, 3.6, 3.7 Anaconda) installed on my Windows machines (7 at work, 10 at home). Unfortunately, the commands in the cmd-prompt are not the same.
The output of the following cmd commands is as follows:
py -> 3.7.1 of Anaconda (work) and 3.7.0 (home)
python -> 2.7.13 (work) and 3.6.2 (home)
pyton2 -> not recognized (work) and 2.7.15 (home)
How can I order the variables, so the same commands call the same version of python? Researching about the path variable I could not find how to define the command that launches a specific python.exe.
I really appreciate your help or a pointing in the right direction.
Kind regards,
Seb
Good Morning,
my apologies, yesterday I did not find this thread here:
In CMD "python" starts Python 3.3, "py" starts Python 2.7, how do I change this?
From now on I will go with "py -X.Y" to start the version of Python I want.
Kind regards,
Seb

Still running python 2.7 when running python in windows 10 command prompt

When I'm running Flask it runs python 2.7, I want it to run on python 3.6.
When I type into the command prompt:
python
it shows it is running python 2.7
So when I type into the command prompt:
echo %PATH%
it shows that python 3.6 is on the top of the variable list.
SO when the path to 3.6 is on top of the list it should automatically run flask in python 3.6 right?
Your PATH is misconfigured, it should only contains path to folders containing binaries, not path to the binary itself
You should change C:\Python36-32\python.exe to C:\Python36-32

Is it possible to use an Anaconda Python 3 environment together with Pycharm?

My basic problem is that I want to install scipy on a Window's machine for Python 3 and use Pycharm as my development environment.
The suggestion from the Scipy Documentation as well as several StackOverflow posts (Installing NumPy and SciPy on 64-bit Windows (with Pip), Trouble installing SciPy on windows, etc.) is to use Anaconda to install a prebuilt scipy and avoid the Fortran and C compilers.
I've used Anaconda for Python 2.7 in the past, so I created an Anaconda environment for Python 3 following these directions.
Command to create the environment
conda create -n py3k python=3 anaconda
And the command to activate the environment
source activate py3k
This works fine, but I do most of my development in PyCharm and I can't figure out how to activate the Anaconda environment from PyCharm. Is there a way to do this or should I take another approach?
Explanations how to configure PyCharm with Anaconda can be found in the documentation.
In PyCharm preferences you can just select the correct python interpreter under,
Project Interpreter > Python Interpreters
As pointed out by #Cecilia, in the case when a virtual environment (e.g. named py3k) is used with Anaconda, the correct python interpreter is located under,
~/Anaconda/envs/py3k/python.exe

Resources