Use the default Python rather than the Anaconda installation when called from the terminal
Anaconda adds the path to your .bashrc
, so it is found first. You can add the path to your default Python instance to .bashrc
or remove the path to Anaconda if you don't want to use it.
You can also use the full path /usr/bin/python
in Bash to use the default Python interpreter.
If you leave your .bashrc
file as is, any command you run using python
will use the Anaconda interpreter. If you want, you could also use an alias
for each interpreter.
You will see something like export PATH=$HOME/anaconda/bin:$PATH
in your .bashrc
file.
So basically, if you want to use Anaconda as your main everyday interpreter, use the full path to your default Python or create an alias
. If you want it the other way around, remove the export PATH=...
. from bashrc
and use full path to Anaconda Python interpreter.
How to change cmd python from anaconda to default python?
Set the environment path variable of your default python interpreter in system properties.
or if this doesn't work do:
in cmd C:\Python27\python.exe yourfilename.py
in the command first part is your interpreter location and second is your file name
Why can't Python find the module I installed?
You have 2 versions of Python:
- Default Python (used everytime you open your command prompt and type
python
orpython3
) - Anaconda is installing packages in a virtual environment, using it's own Python (it is located in a different path)
You can see the path of your installed python using python -c "import os, sys; print(os.path.dirname(sys.executable))"
You have 2 Options:
- Configure the PyCharm in order to use the anaconda Python. https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html#view_list
- Open a command prompt in the project's folder (you can do it easily using PyCharm). Type
conda env list
. This will show you all available anaconda virtual environments. Choose 1 of them and typeconda activate <env_name>
, where <env_name>=the name of the environment. Then, run your program usingpython <name_of_your_program>
You can see the paths where the anaconda environments and packages are installed using conda info
Working with Anaconda in Visual Studio Code
Activating a conda environment does not place conda
on your PATH
. You need to launch the Anaconda Prompt
app from your Start menu to get a command-line with conda
on your PATH
if you didn't check the box to include conda
during installation.
Also realize that conda
only supports PowerShell as of conda
4.6 which was released in January 2019.
And the Python extension for VS Code works with conda
fine. Create a conda
environment and the extension will allow you to select it as your environment/interpreter.
Related Topics
How to Install Pyodbc on Linux
How to Create Variable Variables
Accessing the Index in 'For' Loops
When Should I (Not) Want to Use Pandas Apply() in My Code
How to Detect Collisions Between Two Rectangular Objects or Images in Pygame
If/Else in a List Comprehension
What's With the Integer Cache Maintained by the Interpreter
Is False == 0 and True == 1 an Implementation Detail or Is It Guaranteed by the Language
How to Set Your Pythonpath in an Already-Created Virtualenv
How to Update-Alternatives to Python 3 Without Breaking Apt
List of Lists Changes Reflected Across Sublists Unexpectedly
Relative Imports For the Billionth Time
How to Iterate Over a List in Chunks
How to Use Threading in Python
How to Rotate an Image Around Its Center Using Pygame
Are a Wsgi Server and Http Server Required to Serve a Flask App