迄今为止做大的坑...

2017-08-24  本文已影响0人  Gouwal

1. Pip

python -m pip install -U pip # for updating the pip in py36



PS C:\Users\CNNEZHA2> py36 -m pip install -U pip
Requirement already up-to-date: pip in c:\users\cnnezha2\appdata\local\continuum\anaconda3\envs\py36\lib\site-packages

CNNEZHA2@CN-L-0401092 MINGW64 ~/AppData/Local/Continuum/Anaconda3/envs/Py36/Scri                                                                                                                                  pts
$ py36 -m pip install pip
Requirement already satisfied: pip in c:\users\cnnezha2\appdata\local\continuum\                                                                                                                                  anaconda3\envs\py36\lib\site-packages

CNNEZHA2@CN-L-0401092 MINGW64 ~/AppData/Local/Continuum/Anaconda3/envs/Py36/Scri                                                                                                                                  pts
$ pip install virtualenv
failed to create process.

CNNEZHA2@CN-L-0401092 MINGW64 ~/AppData/Local/Continuum/Anaconda3/envs/Py36/Scri                                                                                                                                  pts
$ py36 -m pip install virtualenv # see how to successful create the virtualenv
Collecting virtualenv
  Downloading virtualenv-15.1.0-py2.py3-none-any.whl (1.8MB)
Installing collected packages: virtualenv
Successfully installed virtualenv-15.1.0
 CNNEZHA2@CN-L-0401092 MINGW64 ~/AppData/Local/Continuum/Anaconda3/envs/Py36/Scri                                                                                                                                  pts
$ virtualenv my_env
Using base prefix 'c:\\users\\cnnezha2\\appdata\\local\\continuum\\anaconda3\\en                                                                                                                                  vs\\py36'
New python executable in C:\Users\CNNEZHA2\AppData\Local\Continuum\Anaconda3\env                                                                                                                                  s\Py36\Scripts\my_env\Scripts\py36.exe
Also creating executable in C:\Users\CNNEZHA2\AppData\Local\Continuum\Anaconda3\                                                                                                                                  envs\Py36\Scripts\my_env\Scripts\python.exe
Installing setuptools, pip, wheel...done.

 CNNEZHA2@CN-L-0401092 MINGW64 ~/AppData/Local/Continuum/Anaconda3/envs/Py36/Scripts
$ ls
2to3.exe*       activate*     conda*     deactivate*     easy_install.exe*       idle.exe*       my_env/   pip-script.py  pydoc-script.py  wheel.exe*
2to3-script.py  activate.bat  conda.bat  deactivate.bat  easy_install-script.py  idle-script.py  pip.exe*  pydoc.exe*     virtualenv.exe*  wheel-script.py


Keng....

2. Virtualenv

>  1. which virtualen in Git Base
>  2. which pip in Git Base
>  3. which py36
>  4. which ....
>  5. The amazing  .\\activate
CNNEZHA2@CN-L-0401092 MINGW64 ~/AppData/Local/Continuum/Anaconda3/envs/Py36/Scripts/her_env/Scripts
$ source activate
(my_env)
CNNEZHA2@CN-L-0401092 MINGW64 ~/AppData/Local/Continuum/Anaconda3/envs/Py36/Scripts/her_env/Scripts

- How to directly activate in PoSh

PS C:\Users\CNNEZHA2> .\\AppData\Local\Continuum\Anaconda3\envs\Py36\Scripts\her_env\Scripts\activate
(her_env) PS C:\Users\CNNEZHA2> activate
(her_env) PS C:\Users\CNNEZHA2> deactivate
PS C:\Users\CNNEZHA2> activate
(my_env) PS C:\Users\CNNEZHA2>
(my_env) PS C:\Users\CNNEZHA2> deactivate
PS C:\Users\CNNEZHA2> .\\AppData\Local\Continuum\Anaconda3\envs\Py36\Scripts\her_env\Scripts\activate
(her_env) PS C:\Users\CNNEZHA2>

![](Pi%204)

How such a big keng!!!! Make sure you login with the Powershell Administrator!!!!!!

  1. Then I try "\Scripts\my_env\Scripts\activate" is still not working in PoSh

  2. Then I directly cd to the fold: C:\Users\CNNEZHA2\AppData\Local\Continuum\Anaconda3\envs\Py36\Scripts\my_env\Scripts

  3. And with directly : PS C:\Users\CNNEZHA2\AppData\Local\Continuum\Anaconda3\envs\Py36\Scripts\my_env\Scripts> activate.ps1

  4. Final results:(my_env) PS C:\Users\CNNEZHA2\AppData\Local\Continuum\Anaconda3\envs\Py36\Scripts\my_env\Scripts>

After the restarting of the PoSh, you can test like this; :), pls note the (my_env)

     Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

PS C:\Users\CNNEZHA2> activate
(my_env) PS C:\Users\CNNEZHA2> deactivate
PS C:\Users\CNNEZHA2>

2.1 Environment Variables

Environment Variables is soooooo important, you need to add the fold which your module is in.

%SystemRoot%\system32\WindowsPowerShell\v1.0\;C:\Windows\System32;%SystemRoot%\system32\WindowsPowerShell\v1.0\;C:\Windows\System32;%SystemRoot%\system32\WindowsPowerShell\v1.0\;C:\Users\CNNEZHA2\AppData\Local\Continuum\Anaconda3\envs\Py36;C:\Users\CNNEZHA2\AppData\Local\Continuum\Anaconda3\envs\Py36\Scripts\my_env\Scripts;C:\Users\CNNEZHA2\AppData\Local\Continuum\Anaconda3\envs\Py36;C:\Users\CNNEZHA2\AppData\Local\Continuum\Anaconda3\envs\Py36\Scripts

2.2 Execution Policy

Make sure you login the Powershell in Administrator!!

use code in Powershell, and with Yes for the second step, then all your downloading scripts can be executed by win Powershell.

PS C:> Set-ExecutionPolicy RemoteSigned


User Guide for Virtualenv


Huge....
上一篇 下一篇

猜你喜欢

热点阅读