Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding Python 2.7 & 3.x Interpreters to PyCharm

I'm having issues adding a project interpreter to PyCharm from a new Anaconda environment. I have Anaconda2 installed with one Python 2.7 environment (C:\Anaconda2\python.exe) that I've been using on Pycharm without issue for several months.

I am attempting to add a second Python 3.6 interpreter (from C:\Anaconda2\envs\py36\python.exe) to my PyCharm. After adding the Local Interpreter to Pycharm, I run into a MS Visual C++ Runtime Error R6034 "An application has made an attempt to load the C runtime library incorrectly".

From cursory googling, it seems that there could be a runtime DLL conflict (potentially msvcr90.dll) between Python 2 & 3. All fixes I see involve editing the executable path of the application, but I don't think this is feasible for my Pycharm use case. How do I get rid of this error, or just generally be able to use both Python 2 & 3 interpreters through my PyCharm?

like image 962
Alex Avatar asked Mar 02 '18 20:03

Alex


People also ask

Is Python 2.7 still available?

We are volunteers who make and take care of the Python programming language. We have decided that January 1, 2020, was the day that we sunset Python 2.


Video Answer


2 Answers

I think that's the problem with Anaconda and different msvc dll in the computer.

You can test the conda command in the command line, to see if R6034 happens. If it happens, try the following solution:

I had a similar problem with Anaconda3 and Python27. I solved this problem via executing the following command in cmd, outside of any conda environment:

conda install msvc_runtime

After installing the packages, open a new command and test if the R6034 error still appears.

like image 183
Huanfa Chen Avatar answered Oct 06 '22 00:10

Huanfa Chen


I had a similar issue and was able to resolve it by selecting:

File --> Invalid Caches / Restart...

from PyCharm's main menu.

You may also want to double check that any Conda Environments that you have defined as Python Interpreters in PyCharm are properly configured per the docs

like image 41
Grant Humphries Avatar answered Oct 05 '22 23:10

Grant Humphries