简体   繁体   English

pipenv 无法安装软件包并引发错误

[英]pipenv can't install packages and throws an error

I am a newbie to python.我是 python 的新手。 I have just installed Python and Pip.我刚刚安装了 Python 和 Pip。
I need to install some packages for a personal project.我需要为个人项目安装一些软件包。
I created a virtual environment using $ pipenv shell .我使用$ pipenv shell创建了一个虚拟环境。
I then ran $ pipenv install dlib .然后我运行$ 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.我在 Windows 10 x64 位系统上运行 Python 3.8.3 和 Pip 20.1.1。

Thanks for your help in advance!提前感谢您的帮助!

this means your pip command path is not set in the path variables of system这意味着您的 pip 命令路径未在系统的路径变量中设置

You can try doing the following:您可以尝试执行以下操作:

  • go to This Pc>properties>Advanced Settings>environment variables go 到这台电脑>属性>高级设置>环境变量

  • ..then click new ..然后点击新建

  • ..then select the path where your python pip command is available ..然后 select 您的 python pip 命令可用的路径

  • .. and simply give it a name python38 thats it ..简单地给它一个名字python38就是这样

  • then it will create your venv然后它会创建你的venv

if you want to use virtual environment you can use virtualenv package in python work with this package is easy如果你想使用虚拟环境,你可以在 python 中使用 virtualenv package 使用这个 package 很容易

you can install this package with你可以安装这个 package

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 go 到您想要在系统中的路径,并在您的 windows cmd 中使用此代码

virtualenv [name_of_your_folder]

then with cd command go to the folder created and open Scripst folder然后使用 cd 命令 go 到创建的文件夹并打开 Scripst 文件夹

then use this然后用这个

activate.bat

By following these steps, you will enter the Python virtual environment on your system按照这些步骤,您将在您的系统上进入 Python 虚拟环境

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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