简体   繁体   中英

pipenv can't install packages and throws an error

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!

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

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

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