Skip to content

Instantly share code, notes, and snippets.

@vlasovskikh
Last active March 20, 2024 22:11
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vlasovskikh/968240f877117cb6c882 to your computer and use it in GitHub Desktop.
Save vlasovskikh/968240f877117cb6c882 to your computer and use it in GitHub Desktop.
Information about Python interpreter and environment
import sys
import os
import pkg_resources
from pprint import pprint
pprint({
'sys.version_info': sys.version_info,
'sys.prefix': sys.prefix,
'sys.path': sys.path,
'pkg_resources.working_set': list(pkg_resources.working_set),
'PATH': os.environ['PATH'].split(os.pathsep),
})
@hugh52
Copy link

hugh52 commented Feb 4, 2020

i have no idea if this is what you all are having trouble with, but if you are having trouble importing packages, you can try the following:
in file -> settings -> project: ... -> project interpreter, after changing the project interpreter to your local python installation (mine for example is '/usr/bin/python3.6') then most libs should be importable. furthermore, clicking the "+" to install more gives a "manage repositories" option at the bottom, where it looks like you should be able to add more packages from repositories instead of simply the ones from pypi. again, no idea if this is what you are looking for but hope it helps someone...

@SSZero88
Copy link

This issue is happening to me as well. The outputs in both my python shell and in pycharm are identical, but pycharm shows these modules as unresolved. My project interpreter is the same as the interpreter used for my python shell. How is this happening?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment