【问题标题】:selenium and tweepy installed but not imported in jupyter notebookselenium 和 tweepy 已安装但未在 jupyter 笔记本中导入
【发布时间】:2018-12-09 18:54:59
【问题描述】:

我使用 pipenv 在目录 (TextProcessing) 中创建并安装了包(numpy、pandas、scikit-learn、tweepy、nltk、selenium、bs4、ipykernel)。

我将 ipython 安装为:

pipenv install ipykernel

当我激活环境并启动 jupyter notebook 时:

(TextProcessing) bash-3.2$ jupyter notebook

在 jupyter notebook 中,我可以成功导入 numpy、sklearn、pandas、bs4,但不能导入 selenium 和 tweepy:

ModuleNotFoundError: No module named 'selenium'
ModuleNotFoundError: No module named 'tweepy'

更多信息: macOS 莫哈韦 python 3.7,蟒蛇

点文件:

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
selenium = "*"
bs4 = "*"
pandas = "*"
numpy = "*"
tweepy = "*"
nltk = "*"
scikit-learn = "*"
ipykernel = "*"

[requires]
python_version = "3.7"

与ipython相关的部分pipfile.loc:

},
        "ipykernel": {
            "hashes": [
                "sha256:0aeb7ec277ac42cc2b59ae3d08b10909b2ec161dc6908096210527162b53675d",
                "sha256:0fc0bf97920d454102168ec2008620066878848fcfca06c22b669696212e292f"
            ],
            "index": "pypi",
            "version": "==5.1.0"
        },
        "ipython": {
            "hashes": [
                "sha256:6a9496209b76463f1dec126ab928919aaf1f55b38beb9219af3fe202f6bbdd12",
                "sha256:f69932b1e806b38a7818d9a1e918e5821b685715040b48e59c657b3c7961b742"
            ],
            "version": "==7.2.0"
        },
        "ipython-genutils": {
            "hashes": [
                "sha256:72dd37233799e619666c9f639a9da83c34013a73e8bbc79a7a6348d93c61fab8",
                "sha256:eb2e116e75ecef9d4d228fdc66af54269afa26ab4463042e33785b887c628ba8"
            ],
            "version": "==0.2.0"
        },
        "jedi": {
            "hashes": [
                "sha256:0191c447165f798e6a730285f2eee783fff81b0d3df261945ecb80983b5c3ca7",
                "sha256:b7493f73a2febe0dc33d51c99b474547f7f6c0b2c8fb2b21f453eef204c12148"
            ],
            "version": "==0.13.1"
        },
        "jupyter-client": {
            "hashes": [
                "sha256:27befcf0446b01e29853014d6a902dd101ad7d7f94e2252b1adca17c3466b761",
                "sha256:59e6d791e22a8002ad0e80b78c6fd6deecab4f9e1b1aa1a22f4213de271b29ea"
            ],
            "version": "==5.2.3"
        },
        "jupyter-core": {
            "hashes": [
                "sha256:927d713ffa616ea11972534411544589976b2493fc7e09ad946e010aa7eb9970",
                "sha256:ba70754aa680300306c699790128f6fbd8c306ee5927976cbe48adacf240c0b7"
            ],
            "version": "==4.4.0"

【问题讨论】:

    标签: python selenium jupyter-notebook virtualenv pipenv


    【解决方案1】:

    原来我必须安装 jupyter notebook 并启动如下,它现在正在工作,我可以导入 jupyter notebook 中的所有包:

    (TextProcessing) bash-3.2$ pipenv install jupyter
    (TextProcessing) bash-3.2$ pipenv run jupyter notebook
    

    【讨论】:

      猜你喜欢
      • 2018-05-01
      • 1970-01-01
      • 2018-07-19
      • 1970-01-01
      • 2021-02-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多