安装transformer时报错。
pip install transformers
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting transformers
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d5/43/cfe4ee779bbd6a678ac6a97c5a5cdeb03c35f9eaebbb9720b036680f9a2d/transformers-4.6.1-py3-none-any.whl (2.2 MB)
|████████████████████████████████| 2.2 MB 187 kB/s
Requirement already satisfied: tqdm>=4.27 in d:\documents\user\application data\python\python37\site-packages (from transformers) (4.53.0)
Requirement already satisfied: importlib-metadata in d:\documents\user\application data\python\python37\site-packages (from transformers) (1.7.0)
Requirement already satisfied: regex!=2019.12.17 in c:\programdata\anaconda3\envs\gpu\lib\site-packages (from transformers) (2020.11.13)
Requirement already satisfied: requests in c:\programdata\anaconda3\envs\gpu\lib\site-packages (from transformers) (2.25.1)
Requirement already satisfied: packaging in c:\programdata\anaconda3\envs\gpu\lib\site-packages (from transformers) (20.8)
Collecting huggingface-hub==0.0.8
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/a1/88/7b1e45720ecf59c6c6737ff332f41c955963090a18e72acbcbeac6b25e86/huggingface_hub-0.0.8-py3-none-any.whl (34 kB)
Collecting numpy>=1.17
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/ce/de/0ed39fd77c5584cd9e44b4305ee4444ea7af1b38d4d71734ae684fc14184/numpy-1.20.3-cp37-cp37m-win_amd64.whl (13.6 MB)
|████████████████████████████████| 13.6 MB 437 kB/s
Collecting tokenizers<0.11,>=0.10.1
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/98/58/b092e16beb8cc360025f8cd26e2f4deb1492e43a22de0cb499793d71ea30/tokenizers-0.10.3-cp37-cp37m-win_amd64.whl (2.0 MB)
|████████████████████████████████| 2.0 MB 467 kB/s
Collecting filelock
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/93/83/71a2ee6158bb9f39a90c0dea1637f81d5eef866e188e1971a1b1ab01a35a/filelock-3.0.12-py3-none-any.whl (7.6 kB)
Requirement already satisfied: zipp>=0.5 in c:\programdata\anaconda3\envs\gpu\lib\site-packages (from importlib-metadata->transformers) (3.4.0)
Requirement already satisfied: pyparsing>=2.0.2 in c:\programdata\anaconda3\envs\gpu\lib\site-packages (from packaging->transformers) (2.4.7)
Requirement already satisfied: chardet<5,>=3.0.2 in c:\programdata\anaconda3\envs\gpu\lib\site-packages (from requests->transformers) (4.0.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\programdata\anaconda3\envs\gpu\lib\site-packages (from requests->transformers) (1.26.2)
Requirement already satisfied: idna<3,>=2.5 in c:\programdata\anaconda3\envs\gpu\lib\site-packages (from requests->transformers) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in c:\programdata\anaconda3\envs\gpu\lib\site-packages (from requests->transformers) (2020.12.5)
Collecting sacremoses
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/75/ee/67241dc87f266093c533a2d4d3d69438e57d7a90abb216fa076e7d475d4a/sacremoses-0.0.45-py3-none-any.whl (895 kB)
|████████████████████████████████| 895 kB 504 kB/s
Requirement already satisfied: joblib in d:\documents\user\application data\python\python37\site-packages (from sacremoses->transformers) (1.0.0)
Requirement already satisfied: click in c:\programdata\anaconda3\envs\gpu\lib\site-packages (from sacremoses->transformers) (7.1.2)
Requirement already satisfied: six in c:\programdata\anaconda3\envs\gpu\lib\site-packages (from sacremoses->transformers) (1.15.0)
Installing collected packages: filelock, tokenizers, sacremoses, numpy, huggingface-hub, transformers
WARNING: Failed to write executable - trying to use .deleteme logic
ERROR: Could not install packages due to an EnvironmentError: [WinError 2] 系统找不到指定的文件。: 'C:\ProgramData\Anaconda3\envs\gpu\Scripts\sacremoses.exe' -> 'C:\ProgramData\Anaconda3\envs\gpu\Scripts\sacremoses.exe.deleteme'
解决办法
python -m pip install --upgrade pip --user
pip install transformers --user