<ruby id="h6500"><table id="h6500"></table></ruby>
    1. <ruby id="h6500"><video id="h6500"></video></ruby>
          1. <progress id="h6500"><u id="h6500"><form id="h6500"></form></u></progress>

            Anaconda安裝配置Python虛擬環(huán)境后使用JupyterNoteBook導入新包失敗的解決方法

            2024年1月10日 1830點(diǎn)熱度 0人點(diǎn)贊 0條評論

            今天在使用Python的時(shí)候,使用Anaconda創(chuàng )建了一個(gè)虛擬環(huán)境,在Jupyter Notebook中也激活了這個(gè)虛擬環(huán)境,而且在這個(gè)環(huán)境下也安裝好了相應的包
            但怎么實(shí)驗,也無(wú)法在Jupyter Notebook中成功import新包,報錯顯示No module xxx found。

            實(shí)驗了各種方法均不成功,后按照下文的方式重新配置一個(gè)新的虛擬環(huán)境后,再次安裝新包成功,特此記錄一下方法。

            文章的鏈接和具體內容如下:

            在Windows下,為Jupyter創(chuàng )建新的kernel

            1.創(chuàng )建環(huán)境

            • 打開(kāi)Anaconda Prompt
            • 輸入以下代碼創(chuàng )建環(huán)境
            (D:\Users\拾夕\Anaconda3) C:\Users\拾夕>conda create -n KernelForJupyter python=3.6
            
            • 得到以下結果
            The following NEW packages will be INSTALLED:
            
                certifi:        2016.2.28-py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
                pip:            9.0.1-py36_1     https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
                python:         3.6.2-0          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
                setuptools:     36.4.0-py36_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
                vc:             14-0             https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
                vs2015_runtime: 14.0.25420-0     https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
                wheel:          0.29.0-py36_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
                wincertstore:   0.2-py36_0       https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
            Proceed ([y]/n)? y
            Linking packages ...
            [      COMPLETE      ]|##################################################| 100%
            #
            # To activate this environment, use:
            # > activate KernelForJupyter
            #
            # To deactivate this environment, use:
            # > deactivate KernelForJupyter
            #
            # * for power-users using bash, you must source
            #
            

            2.激活環(huán)境以及安裝必要的包

            • 輸入以下代碼激活環(huán)境
            (D:\Users\拾夕\Anaconda3) C:\Users\拾夕> activate KernelForJupyter
            
            • 安裝 ipykernel
            (KernelForJupyter) C:\Users\拾夕>conda install ipykernel
            

            3.創(chuàng )建新的kernel

            • 輸入以下代碼創(chuàng )建新的kernel
            (KernelForJupyter) C:\Users\拾夕>python -m ipykernel install --name NewKernel
            Installed kernelspec NewKernel in C:\ProgramData\jupyter\kernels\newkernel
            
            • 然后就可以在Jupyter中使用了

            4.Jupyter其他操作

            • 我們通過(guò)以下代碼查看juypter kernel的其他命令
            (KernelForJupyter) C:\Users\拾夕>jupyter kernelspec --help
            Manage Jupyter kernel specifications.
            Subcommands
            -----------
            Subcommands are launched as `jupyter kernelspec cmd [args]`. For information on
            using subcommand 'cmd', do: `jupyter kernelspec cmd -h`.
            list
                List installed kernel specifications.
            install
                Install a kernel specification directory.
            uninstall
                Alias for remove
            remove
                Remove one or more Jupyter kernelspecs by name.
            install-self
                [DEPRECATED] Install the IPython kernel spec directory for this Python
            
            • 例如我們可以通過(guò)以下指令查看當前環(huán)境下的kernel

            (KernelForJupyter) C:\Users\拾夕>jupyter kernelspec list
            Available kernels:
            python3 D:\Users\拾夕\Anaconda3\envs\KernelForJupyter\share\jupyter\kernels\python3
            newkernel C:\ProgramData\jupyter\kernels\newkernel

            領(lǐng)測老賀

            領(lǐng)測軟件測試網(wǎng)站長(cháng),ISTQB認證高級培訓師,TMMi認證咨詢(xún)師。深耕軟件測試行業(yè)20余年,領(lǐng)測老賀聊軟件測試制造者。

            文章評論

            老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月
              <ruby id="h6500"><table id="h6500"></table></ruby>
              1. <ruby id="h6500"><video id="h6500"></video></ruby>
                    1. <progress id="h6500"><u id="h6500"><form id="h6500"></form></u></progress>