Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
already changed interpreter to python3
it is working on bash terminal both python 2.7 and python3
import datetime as dt
import numpy
import matplotlib as plt
from matpololib import style
import pandas as pd
import pandas_datareader.data as web
style.use('ggplot')
–
–
–
–
assume that you're using macOS with pyenv for different python versions.
Take the matplotlib stacked bar graph bar_stacked.py
as the example (you could get the .py
from https://matplotlib.org/gallery/lines_bars_and_markers/bar_stacked.html#sphx-glr-gallery-lines-bars-and-markers-bar-stacked-py).
short answer: quickly configure pyenv python as this snapshot shows:
quick config steps
details
open the bar_stacked.py with PyCharm;
check your python environment settings:
2.1 check your python version with your terminal:
ABC-MacBook-Pro:~ ABC$ which python
/Users/ABC/.pyenv/shims/python
2.2 check your pyenv installed pythons
ABC-MacBook-Pro:~ ABC$ pyenv versions
system
* 3.7.0 (set by /Users/ABC/.python-version)
2.3 confirm the python version you're using, here is Python 3.7.0
ABC-MacBook-Pro:~ ABC$ python --version
Python 3.7.0
3.configure the PyCharm interpreter as follows:
3.1 PyCharm
-> Preferences
-> Project
-> Project Interpreter
, you'll see a icon like a gear, click it and choose Add...
3.2 choose Virtualenv Environment
on the left
3.3 choose Existing environment
on the right, in the pop-up, locate the python i'm using as checked in step 2.1, here is /Users/ABC/.pyenv/shims/python
3.4 you can also check the box Make available to all projects
if you want
finally, this example in PyCharm runs like this:
running
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.