Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/313.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 为什么在安装重新压缩的库时失败?_Python - Fatal编程技术网

Python 为什么在安装重新压缩的库时失败?

Python 为什么在安装重新压缩的库时失败?,python,Python,我有一个带有.tar.gz的压缩模型文件,解压缩后看起来像: ls -lah zh_core_web_lg-2.3.1 total 56 drwxr-xr-x@ 9 congminmin staff 288B Oct 10 02:40 . drwxr-xr-x 6 congminmin staff 192B Oct 10 02:57 .. -rw-r--r--@ 1 congminmin staff 17B Jun 17 00:30 MANIFEST.in -rw-r--r

我有一个带有.tar.gz的压缩模型文件,解压缩后看起来像:

ls -lah zh_core_web_lg-2.3.1
total 56
drwxr-xr-x@ 9 congminmin  staff   288B Oct 10 02:40 .
drwxr-xr-x  6 congminmin  staff   192B Oct 10 02:57 ..
-rw-r--r--@ 1 congminmin  staff    17B Jun 17 00:30 MANIFEST.in
-rw-r--r--@ 1 congminmin  staff   398B Jun 17 00:30 PKG-INFO
-rw-r--r--@ 1 congminmin  staff   9.3K Jun 17 00:30 meta.json
-rw-r--r--@ 1 congminmin  staff    38B Jun 17 00:30 setup.cfg
-rw-r--r--@ 1 congminmin  staff   1.7K Jun 17 00:30 setup.py
drwxr-xr-x@ 5 congminmin  staff   160B Oct 10 02:40 zh_core_web_lg
drwxr-xr-x@ 8 congminmin  staff   256B Oct 10 02:40 zh_core_web_lg.egg-info
我可以通过以下方式安装它:

pip install zh_core_web_lg-2.3.1.tar.gz
但是,如果我解压缩它并立即使用以下两个命令将其压缩回来:

tar -xf zh_core_web_lg-2.3.1.tar.gz
tar -czf zh_core_web_lg-2.3.1.tar.gz zh_core_web_lg-2.3.1
除了解压缩和压缩之外,这些命令不做任何其他事情。现在,如果我重新运行:

pip install zh_core_web_lg-2.3.1.tar.gz
我在Mac上,它报告了此错误:

pip install zh_core_web_lg-2.3.1.tar.gz
Processing ./zh_core_web_lg-2.3.1.tar.gz
    ERROR: Command errored out with exit status 1:
     command: /Users/congminmin/.venv/wbnlu/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/cr/x7st48l55rx8ntr0vxk242vr0000gn/T/pip-req-build-po3vp3ls/setup.py'"'"'; __file__='"'"'/private/var/folders/cr/x7st48l55rx8ntr0vxk242vr0000gn/T/pip-req-build-po3vp3ls/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/cr/x7st48l55rx8ntr0vxk242vr0000gn/T/pip-pip-egg-info-ghku35yl
         cwd: /private/var/folders/cr/x7st48l55rx8ntr0vxk242vr0000gn/T/pip-req-build-po3vp3ls/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/Users/congminmin/anaconda3/lib/python3.8/tokenize.py", line 392, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: '/private/var/folders/cr/x7st48l55rx8ntr0vxk242vr0000gn/T/pip-req-build-po3vp3ls/setup.py'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
pip安装zh_core_web_lg-2.3.1.tar.gz
处理./zh_core_web_lg-2.3.1.tar.gz
错误:命令出错,退出状态为1:
命令:/Users/congminmin/.venv/wbnlu/bin/python-c'import sys,setuptools,tokenize;sys.argv[0]=“private/var/folders/cr/x7st48l55rx8ntr0vxk242vr0000gn/T/pip-req-build-po3vp3ls/setup.py”“”__文件“''”/private/var/folders/cr/x7st48l55rx8ntr0vxk242vr0000gn/T/pip-req-build-po3vp3ls/setup.py''”;f=getattr(标记化,“'open'”,open)(\uuuuu文件);code=f.read().replace(“\r\n”“”、“\n”“”);f、 close();exec(编译(代码,“‘exec’”)‘蛋’信息——蛋基/private/var/folders/cr/x7st48l55rx8ntr0vxk242vr0000gn/T/pip-pip-egg-info-ghku35yl
cwd:/private/var/folders/cr/x7st48l55rx8ntr0vxk242vr0000gn/T/pip-req-build-po3vp3ls/
完整输出(5行):
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“/Users/congminmin/anaconda3/lib/python3.8/tokenize.py”,第392行,打开
缓冲区=\u内置\u打开(文件名'rb')
FileNotFoundError:[Errno 2]没有这样的文件或目录:'/private/var/folders/cr/x7st48l55rx8ntr0vxk242vr0000gn/T/pip-req-build-po3vp3ls/setup.py'
----------------------------------------
错误:命令出错,退出状态为1:python setup.py egg_info检查日志以获得完整的命令输出。
这个问题在Linux机器上不会发生。在解压和压缩后,我仍然可以正确安装pip

“tar-czf”会改变包的结构吗