Running Jupyter Notebook from cmd raises ModuleNotFoundError: No module named pysqlite2

前端 未结 5 1106
我寻月下人不归
我寻月下人不归 2020-12-06 19:59

The problem:

After reinstalling Anaconda I can no longer navigate to a folder using the command window where I\'ve got some .pynb files

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-06 20:27

    This answer is for users who might have compiled Python from source and also for the users who dont have admin rights (as a result I cant use Homebrew). I faced the same error but my python environment is customised and I am not using anaconda or pyenv. A side note, my OS is macOS mojave 10.14.6.

    I recompiled and reconfigured sqlite manually from source package. Steps:

    1. Download sqlite tarfile from this page.
    2. Navigate to the /path/to/python_dir/Python-3.x.x/Modules where your Python version is installed. (Because I am not the admin I installed it here : /Users/myusername/python3. ) : /Users/myusername/python3/Python-3.6.8/Modules/
    3. Extract sqlite under /Modules/: tar zxf /Users/myusername/Downloads/sqlite.tar.gz
    4. cd sqlite
    5. configure sqlite locally : ./configure --prefix='/Users/myusername/python3'
      side note: without the prefix option make install will install files in default location. check this answer. So use the prefix option if your python is not at default location.
    6. make && make install
    7. go back to python folder and reconfigure python binaries, and point to sqlite :
      cd ../../ and then:
      ./configure --prefix='/Users/myusername/python3' --with-sqlite='/Users/myusername/python3'.
    8. make && make install

    Side note : It turns out that if you configured Python manually and you can't install some library using pip probably you have to configure and recompile that package from source. Download the tar file of your package and repeat the above steps for your package. I also had problems with zlib and openssl and i did the same as above.
    Some other threads you might find useful : this , maybe this also

提交回复
热议问题