pipenv can't install packages and throws an error

三世轮回 提交于 2020-08-11 05:05:58

问题


I am a newbie to python. I have just installed Python and Pip.
I need to install some packages for a personal project.
I created a virtual environment using $ pipenv shell.
I then ran $ pipenv install dlib.
But I received the following error:

Error text:
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = 'C:\Users\samya\.virtualenvs\py_img_recog-DAsXOW1h\Scripts\python.exe'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = 'C:\\Users\\samya\\.virtualenvs\\py_img_recog-DAsXOW1h\\Scripts\\python.exe'
  sys.base_prefix = ''
  sys.base_exec_prefix = ''
  sys.executable = 'C:\\Users\\samya\\.virtualenvs\\py_img_recog-DAsXOW1h\\Scripts\\python.exe'
  sys.prefix = ''
  sys.exec_prefix = ''
  sys.path = [
    'C:\\Users\\samya\\.virtualenvs\\py_img_recog-DAsXOW1h\\Scripts\\python38.zip',
    '.\\DLLs',
    '.\\lib',
    'c:\\users\\samya\\appdata\\local\\programs\\python\\python38-32',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x000042ec (most recent call first):
<no Python frame>
[   =] Installing dlib...
Installation Failed 

I am running Python 3.8.3 and Pip 20.1.1 on Windows 10 x64 bit system.

Thanks for your help in advance!


回答1:


if you want to use virtual environment you can use virtualenv package in python work with this package is easy

you can install this package with

python[version] -m pip install virtualenv

or use

pip[version] install virtualenv

then

go to path you want in your system and use this code in your windows cmd

virtualenv [name_of_your_folder]

then with cd command go to the folder created and open Scripst folder

then use this

activate.bat

By following these steps, you will enter the Python virtual environment on your system




回答2:


this means your pip command path is not set in the path variables of system

You can try doing the following:

  • go to This Pc>properties>Advanced Settings>environment variables

  • ..then click new

  • ..then select the path where your python pip command is available

  • .. and simply give it a name python38 thats it

  • then it will create your venv



来源:https://stackoverflow.com/questions/62532922/pipenv-cant-install-packages-and-throws-an-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!