簡體   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