pycharm see wrong remote interpreter

已回答

I'm programing on development server (using ssh) 

I set my pycharm using remote interpreter "/local/common/anaconda3/bin/python".

 

The problem is pycharm see a "/usr/bin/python" as a interpreter 

This image is my interpreter setting 

But, in code, 

import os 

os.system ('which python')

 

This code print out "

Python path on pycharm is not same to I set

 

When run that code in terminal, 

Running results on pycharm and terminal are not same 

 

How can I solve it?

0

Hi Grayapple! I believe anaconda append itself to PATH in `.bashrc` or `.bash_profile` so at the moment you log in it replace python executable path so that's why you have anaconda's python in terminal. This doesn't happened in case of remote run with PyCharm. What is your final goal with this script?

0
Avatar
Permanently deleted user

Thank you Pavel Karateev, I want to write a code on my desktop with remote interpreter. I write my code with 3.x rule and unicode data. But pycharm see interpreter in usr/bin/ (even though i already setanaconda/python as a project interpreter )

So pycharm sometimes said error cannot print unicode words 

How can I solve it?

0

Well, correct interpreter is used to run your script, e.g. check the second screenshot first line. You get `/usr/bin/python` after print but it's just the result of calling `which python` and has nothing to do with interpreter used. If you what to get current interpreter path from the script itself you can use:

import sys
print(sys.executable)

 

0

请先登录再写评论。