简体   繁体   中英

Python 2.7 Anaconda2 installed in windows

My Python 2 environmental path:

C:\Python27
C:\Python27\Scripts

My Python 3 environmental path:

C:\Python35
C:\Python35\Scripts

I set the environmental path for Anaconda2

C:\Users\User\Anaconda2\Scripts
C:\Users\User\Anaconda2

But when i typed python to enter the shell in cmd (C:\\Users\\user)

Importing the module of Anaconda like numpy or matplotlib

C:\Users\User>python

Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:24:40) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

>>> import numpy

Traceback (most recent call last): File "", line 1, in ImportError: No module named numpy

C:\Users\User>cd Anaconda2
C:\Users\User\Anaconda2>python

Python 2.7.12 |Anaconda 4.1.1 (64-bit)| (default, Jun 29 2016, 11:07:13) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. Anaconda is brought to you by Continuum Analytics. Please check out: http://continuum.io/thanks and https://anaconda.org

>>> import numpy
>>>

So i don't know

1.Why my module can't import while not in Anaconda2

2.It is said that the path of Python2 will overrdie the Python,so how to enter in the Python35 shell?

thanks everybody

Each Python installation has its own libraries. As you will see, you are not running the same Python 2.7 interpreter when you run with Anaconda active as you are without (I assume that's either the system Python or one you installed yourself).

Libraries installed in one interpreter aren't available to others. You should consider learning about conda environments to allow you to manage multiple projects easily.

The command deactivate should terminate the Anaconda environment, and if the Python 3 interpreter is first on your PATH you should then be able to run it. Another way would be to explicitly use the command

C:\Python35\python

which should work even with Anaconda active.

Caution : it's a long time since I used Windows, and I don't have current information on getting multiple Pythons to live happily together on Windows.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM