繁体   English   中英

如何使用在虚拟环境中工作的jupyter笔记本电脑全新安装Anaconda。 视窗

[英]How to make a clean fresh install of Anaconda with jupyter notebook working on a virtual environement. Windows

问题:

我在Windows上中断了Anaconda安装。 我已卸载并重新安装了几次。 每次我都有不同的问题。 我的目标很简单:我想使用在Windows虚拟环境中工作的jupyter笔记本电脑完整安装Anaconda。

问题正确的程序是什么? 我是在错误地卸载和清洁,还是在错误地安装?

我试过的

卸载/清洁

conda install anaconda-clean
anaconda-clean --yes
Then uninstall python2(anaconda)
Then delete some anaconda folder manualy. .anaconda .conda .ipython .jupyter
Then CCleaner, clean registry
Then reboot

安装

I downolad https://repo.anaconda.com/archive/Anaconda2-2018.12-Windows-x86_64.exe on https://www.anaconda.com/distribution/#windows
I install everithings as default. Except that I add Anaconda to the PATH environment variable, since I want to use environnements. 
I do:
conda create -n mynewenv python=2 MySQL-python pandas numpy matplotlib scikit-learn
activate mynewenv

问题:

I run "jupyter notebook" ( mynewenv still activated )
I can't "import MySQL in my scripts" 

在此处输入图片说明

我试图解决

conda install MySQL-python

我运行“ jupyter笔记本”,同样的问题,我无法“在脚本中导入MySQL”,我在外壳中键入python,然后可以导入MySQLdb:

(mynewenv) C:\Users\me>python
Python 2.7.16 |Anaconda, Inc.| (default, Mar 14 2019, 15:42:17) [MSC v.1500 64 b
it (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
>>> 

因此它可以使用外壳工作,但不适用于jupyter笔记本

我尝试了这个,但是死胡同:

conda install nb_conda_kernels # it should make me able to switch kernel but then can't use jupyter anymore

我尝试过:

conda install jupyter #when mynew env still activated
the idea is to have jupyter installed on the new environnement.( why not )

I get this when installing
Executing transaction: \ DEBUG menuinst_win32:__init__(196): Menu: name: 'Anacon
da${PY_VER} ${PLATFORM}', prefix: 'C:\Users\Y\Anaconda2\envs\mynewenv', env_name
: 'mynewenv', mode: 'user', used_mode: 'user'
DEBUG menuinst_win32:create(320): Shortcut cmd is C:\Users\Y\Anaconda2\python.ex
e, args are [u'C:\\Users\\Y\\Anaconda2\\cwp.py', u'C:\\Users\\Y\\Anaconda2\\envs
\\mynewenv', u'C:\\Users\\Y\\Anaconda2\\envs\\mynewenv\\python.exe', u'C:\\Users
\\Y\\Anaconda2\\envs\\mynewenv\\Scripts\\jupyter-notebook-script.py', u'"%USERPR
OFILE%/"']
done

Then I run 'jupyter notebook'. It run for 5 second then stop. ( no error messages)

I run it again, I get:
(mynewenv) C:\Users\Y>jupyter notebook
Unable to create process using 'C:\Users\Y\Anaconda2\envs\mynewenv\python.exe C:\Users\Y\Anaconda2\envs\mynewenv\Scripts\jupyter-script.py notebook'

这确实为我工作。

卸载/清洁

conda install anaconda-clean
anaconda-clean --yes
Then uninstall python2(anaconda)
Then delete some anaconda folder manually. .anaconda .conda .ipython .jupyter
Then CCleaner, clean registry
Then reboot

正在安装

我下载https://repo.anaconda.com/archive/Anaconda2-2018.12-Windows-x86_64.exehttps://www.anaconda.com/distribution/#windows

I install everything as default. 
Except that I add Anaconda to the PATH environment variable, since I want to use environments. more info: https://stackoverflow.com/questions/52664293/why-or-why-not-add-anaconda-to-path

我会更新所有内容

conda update --all

我创建一个名为mynewenv的新环境。 使用python = 2并安装了以下软件包:MySQL-python pandas numpy matplotlib scikit-learn

conda create -n mynewenv python=2 MySQL-python pandas numpy matplotlib scikit-learn
conda activate mynewenv

然后,我们安装ipkernel,并创建一个新内核。 有关https://anbasile.github.io/programming/2017/06/25/jupyter-venv/的更多信息

pip install ipykernel
ipython kernel install --user --name=mynewenv

在这一点上,您可以启动jupyter,创建一个新的笔记本并选择环境中的内核。

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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