I am trying to create geographical maps of data, and to do this I am trying to use the basemap package. As I was using Python 3.9 on Windows 10, installing basemap was nearly impossible. So I created a new environment running Python 3.6, which allowed me to install basemap with no issues. Now basemap shows up under conda list
command, and my new environment py36
is selectable in VSCode. Once selected, it tells me I am using Python 3.6.12. However, when I simply try to import packages:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
#import basemap
import sys
print(sys.version)
...basemap cannot be imported. (It is commented out in this version so that I could print the version of Python that was running in VSCode). So I commented the import basemap
line out (all other packages imported correctly) and added two lines to print the version of Python that the code snippet was using. The result was surprising: Despite selecting an interpreter that was using 3.6.12 (see image attached, bottom of screen shot), the return for print(sys.version) was
3.9.1 (tags/v3.9.1:1e5d33e, Dec 7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)]
How can I get VSCode to run the version of Python that is defined explicitly in the environment, so that I can import basemap?
Thank you in advance for any help on the subject.
Brad
question from:
https://stackoverflow.com/questions/65867761/vscode-is-running-two-different-versions-of-python-one-for-environment-and-one 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…