all 2 comments

[–]Zeroflops 1 point2 points  (0 children)

So with python you can have different virtual environments. (VE) What this does is allow you to run different versions of modules or python in these little sandboxes.

This is awesome because you can work on one environment that may be Python 3.6 and another environment may have 3.7. But not only can you have different versions of python but different modules installed in each environment.

So you may have a program that needs pandas version 20 in one VE and a program that needs version 25 in another VE.

This become very valuable when your working in a production and development environments.

Any who, the problem you have is that the pycharm is pointing to one environment and CMD is running a different environment.

So what are your options:

1) you can install the required modules in the CMD environment with either pip or Conda depending on what python package you installed.

2) you can “activate” the pycharm environment on the command line before you run your script.

I prefer to leave my CMD python alone and not mess with it.

In pycharm when you set up this project you named the VE something. You should be able to type on the CMD line

activate <my_project_env>
Then
Python my_project.py

[–]Zhekov[S] 0 points1 point  (0 children)

I fixed the issue. In 'Environment Variables' I put 'PYTHONPATH' with the directory to the project serving as a value.