问题描述
我使用的是 Win10 内置 linux 系统并输入 pip install -U .
,然后我得到一个可怕的错误:
ERROR: Could not install packages due to an OSError: [('/mnt/f/MyDownloads/Download/cactus-bin-v1.2.3/.git/branches','/tmp/pip-req-build-luuzar9x/.git/branches',"[Errno 22] Invalid argument: '/tmp/pip-req-build-luuzar9x/.git/branches'"),('/mnt/f/MyDownloads/Download/cactus-bin-v1.2.3/.git/hooks','/tmp/pip-req-build-luuzar9x/.git/hooks',"[Errno 22] Invalid argument: '/tmp/pip-req-build-luuzar9x/.git/hooks'"),('/mnt/f/MyDownloads/Download/cactus-bin-v1.2.3/.git/info','/tmp/pip-req-build-luuzar9x/.git/info',"[Errno 22] Invalid argument: '/tmp/pip-req-build-luuzar9x/.git/info'"),('/mnt/f/MyDownloads/Download/cactus-bin-v1.2.3/.git/logs/refs/heads','/tmp/pip-req-build-luuzar9x/.git/logs/refs/heads',"[Errno 22] Invalid argument: '/tmp/pip-req-build-luuzar9x/.git/logs/refs/heads'"),('/mnt/f/MyDownloads/Download/cactus-bin-v1.2.3/.git/logs/refs/remotes/origin','/tmp/pip-req-build-luuzar9x/.git/logs/refs/remotes/origin',"[Errno 22] Invalid argument: '/tmp/pip-req-build-luuzar9x/.git/logs/refs/remotes/origin'"),('/mnt/f/MyDownloads/Download/cactus-bin-v1.2.3/.git/logs/refs/remotes','/tmp/pip-req-build-luuzar9x/.git/logs/refs/remotes',"[Errno 22] Invalid argument: '/tmp/pip-req-build-luuzar9x/.git/logs/refs/remotes'"),('/mnt/f/MyDownloads/Download/cactus-bin-v1.2.3/.git/logs/refs','/tmp/pip-req-build-luuzar9x/.git/logs/refs',"[Errno 22] Invalid argument: '/tmp/pip-req-build-luuzar9x/.git/logs/refs'"),('/mnt/f/MyDownloads/Download/cactus-bin-v1.2.3/.git/logs','/tmp/pip-req-build-luuzar9x/.git/logs',"[Errno 22] Invalid argument: '/tmp/pip-req-build-luuzar9x/.git/logs'"),
我用的是python3.6,内建的linux系统刚调出来。我真的不知道为什么会出现这样的错误。
解决方法
您是否尝试过升级您的 Python 版本?您可以通过添加/删除程序在 Windows 中执行此操作,或者如果您有巧克力:从您的 powershell(以管理员身份打开)只需运行:
choco upgrade python
在 linux 中,您可以通过运行来实现(根据您的发行版,您可能需要使用 yum 或 dnf 而不是 apt) :
apt update
apt upgrade python
如果您不是 root(管理员),您可能希望在命令前添加 sudo。 我希望这能解决您的问题。