0

我正在尝试以不同的方式从 Power Shell 安装 Windows 8 中的 PGU 库,并在此网页和其他网页上进行了搜索,但均未成功。我也已经尝试过这个其他问题的答案。这是 PowerShell 中显示的内容:

PS C:\Users\Núria> pip install pgu-0.18.zip
Requirement 'pgu-0.18.zip' looks like a filename, but the file does not exist
Processing c:\users\núria\pgu-0.18.zip
Exception:
Traceback (most recent call last):
  File "c:\users\núria\appdata\local\programs\python\python36-32\lib\site-packages\pip\basecommand.py", line 215, in mai
n
    status = self.run(options, args)
  File "c:\users\núria\appdata\local\programs\python\python36-32\lib\site-packages\pip\commands\install.py", line 324, i
n run
    requirement_set.prepare_files(finder)
  File "c:\users\núria\appdata\local\programs\python\python36-32\lib\site-packages\pip\req\req_set.py", line 380, in pre
pare_files
    ignore_dependencies=self.ignore_dependencies))
  File "c:\users\núria\appdata\local\programs\python\python36-32\lib\site-packages\pip\req\req_set.py", line 620, in _pr
epare_file
    session=self.session, hashes=hashes)
  File "c:\users\núria\appdata\local\programs\python\python36-32\lib\site-packages\pip\download.py", line 809, in unpack
_url
    unpack_file_url(link, location, download_dir, hashes=hashes)
  File "c:\users\núria\appdata\local\programs\python\python36-32\lib\site-packages\pip\download.py", line 715, in unpack
_file_url
    unpack_file(from_path, location, content_type, link)
  File "c:\users\núria\appdata\local\programs\python\python36-32\lib\site-packages\pip\utils\__init__.py", line 599, in
unpack_file
    flatten=not filename.endswith('.whl')
  File "c:\users\núria\appdata\local\programs\python\python36-32\lib\site-packages\pip\utils\__init__.py", line 482, in
unzip_file
    zipfp = open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Núria\\pgu-0.18.zip'
PS C:\Users\Núria> pip install pgu-0.18
Collecting pgu-0.18
  Could not find a version that satisfies the requirement pgu-0.18 (from versions: )
No matching distribution found for pgu-0.18
PS C:\Users\Núria> cd Downloads/PYTHON3
PS C:\Users\Núria\Downloads\PYTHON3> pip install pgu-0.18
Collecting pgu-0.18
  Could not find a version that satisfies the requirement pgu-0.18 (from versions: )
No matching distribution found for pgu-0.18
PS C:\Users\Núria\Downloads\PYTHON3> pip install pgu-0.18.zip
Processing c:\users\núria\downloads\python3\pgu-0.18.zip
Installing collected packages: pgu
  Running setup.py install for pgu ... error
Exception:
Traceback (most recent call last):
  File "c:\users\núria\appdata\local\programs\python\python36-32\lib\site-packages\pip\compat\__init__.py", line 73, in
console_to_str
    return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfa in position 43: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\núria\appdata\local\programs\python\python36-32\lib\site-packages\pip\basecommand.py", line 215, in mai
n
    status = self.run(options, args)
  File "c:\users\núria\appdata\local\programs\python\python36-32\lib\site-packages\pip\commands\install.py", line 342, i
n run
    prefix=options.prefix_path,
  File "c:\users\núria\appdata\local\programs\python\python36-32\lib\site-packages\pip\req\req_set.py", line 784, in ins
tall
    **kwargs
  File "c:\users\núria\appdata\local\programs\python\python36-32\lib\site-packages\pip\req\req_install.py", line 878, in
 install
    spinner=spinner,
  File "c:\users\núria\appdata\local\programs\python\python36-32\lib\site-packages\pip\utils\__init__.py", line 676, in
call_subprocess
    line = console_to_str(proc.stdout.readline())
  File "c:\users\núria\appdata\local\programs\python\python36-32\lib\site-packages\pip\compat\__init__.py", line 75, in
console_to_str
    return s.decode('utf_8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfa in position 43: invalid start byte

我不明白这个错误来自哪里以及如何解决它。欢迎任何帮助!

4

1 回答 1

0

将此添加到 setup.py 文件中:

str = unicode(str, errors='ignore')

此外,如果requirements.txt您尝试安装模块的文件夹中有文件,请先执行以下操作:

pip install requirements.txt
于 2018-03-31T18:32:44.913 回答