硒和tweepy已安装,但未导入jupyter笔记本电脑

时间:2018-12-09 18:54:59

标签: python selenium jupyter-notebook virtualenv pipenv

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

我将ipython安装为:

pipenv install ipykernel

当我激活环境并以以下方式启动jupyter笔记本时:

(TextProcessing) bash-3.2$ jupyter notebook

在jupyter笔记本中,我可以成功导入numpy,sklearn,pandas,bs4,但返回时不能导入selenium和tweepy:

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

更多信息: macOS Mojave python 3.7,Anaconda

pipfile:

[[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"

1 个答案:

答案 0 :(得分:0)

事实证明,我必须安装jupyter笔记本,开始如下所示,它现在可以工作,并且我可以导入jupyter笔记本中的所有软件包:

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