简体   繁体   中英

Can't use package after running pipenv install

I've just installed pipenv and then run pipenv istall pymysql which completed successfully. However, when trying to use pymysql with import pymysql I get an "Unable to import 'pymysql'.

Here's my Pipfile:

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

[dev-packages]

[packages]
pymysql = "*"

[requires]
python_version = "3.7"

And Pipfile.lock:

{
    "_meta": {
        "hash": {
            "sha256": "bcb032490d492962ce66934550b641b9c4ac4c6c46efebc19592f35358039e13"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.7"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "pymysql": {
            "hashes": [
                "sha256:3943fbbbc1e902f41daf7f9165519f140c4451c179380677e6a848587042561a",
                "sha256:d8c059dcd81dedb85a9f034d5e22dcb4442c0b201908bede99e306d65ea7c8e7"
            ],
            "index": "pypi",
            "version": "==0.9.3"
        }
    },
    "develop": {}
}

Where does pipenv even install the packages? I can't see anything in my project folder...

Looks like this was just a Visual Studio Code linting error. When running my code it works fine.

The fix was to hit Ctrl + Shift + P in VS Code, search for "python: select interpreter" and change the interpreter to the python.exe in the virtualenv directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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