Skip to content Skip to sidebar Skip to footer

Newbie Python, Pycharm And Anaconda Issues

I'm a newbie following tutorials online. I'm having real troubles with PyCharm, Python and Anaconda. Two questions: (1) when I 'pip install x' in CMD, they only seem to install in

Solution 1:

You have two different python installs running at the same time. Anaconda is python. When you installed it after installing python, you essentially have two now. You should uninstall Python, and reinstall Anaconda.

I really like the Anaconda environment and you should really look at using conda to install most/all of your packages.

Here is a great tutorial: https://www.datacamp.com/community/tutorials/installing-anaconda-windows

Solution 2:

conda allows you to create separate Python environments for different projects. This means you can have different packages, or even different versions of packages, for each project. To use a particular conda environment in PyCharm, you have to configure PyCharm to use that environment. I suggest checking out the PyCharm documentation for more details about how to do that.

Solution 3:

Setting up Anaconda + Pycharm on Windows works like a charm. Maybe the following helps:

1. Installation

  • install Anaconda from www.anaconda.com
  • add Anaconda to your path (offered during installation), e.g. C:\ProgramData\Anaconda3\Scripts

2. Create a Conda Environment (Python+Packages Sandbox)

  • $ conda create -n <env_name> python=<python_version>: create a new Python <python_version> conda environment (e.g. <env_name> = foobar and <python_version>=3.8)

3. Activate and add packages to your environment

  • $ activate <env_name>: activate environment
  • $ pip install <foo_package>: install via pip
  • $ conda install <bar_package>: further conda-offered packages

Remark: activate doesn't work for me with git-bash, but with cmd or powershell

Remark: You can repeat these steps whenever you want to add new packages to your conda environment.

4. Use the environment for your project in PyCharm

  • Open an existing or new PyCharm project
  • Select your conda environment via File > Setting > Project: <your_project> > Python Interpreter e.g. by setting it to C:\ProgramData\Anaconda3\envs\<env_name>\python.exe

Further useful conda commands

  • $ deactivate: deactivate environment
  • $ conda update --all: update all Anaconda packages
  • $ conda install python=3.8: upgrade to a new major Python version (in this case 3.8)
  • $ conda info --envs: list all existing conda environments lazysheets
  • $ conda env export > environment.yaml: export your active environment dependencies
  • $ conda env create -f environment.yaml: create conda environment from environment.yaml

Post a Comment for "Newbie Python, Pycharm And Anaconda Issues"