Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/22.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 协作实验室:如何安装PyGame学习环境_Python_Linux_Jupyter Notebook_Reinforcement Learning_Google Colaboratory - Fatal编程技术网

Python 协作实验室:如何安装PyGame学习环境

Python 协作实验室:如何安装PyGame学习环境,python,linux,jupyter-notebook,reinforcement-learning,google-colaboratory,Python,Linux,Jupyter Notebook,Reinforcement Learning,Google Colaboratory,在Colaboratory中,我们被迫使用pip安装。一些第三包,如健身房、PLE等,其安装应 git clone https://github.com/ntasfi/PyGame-Learning-Environment.git cd PyGame-Learning-Environment/ pip install -e . 当我尝试时,以下是一些问题: 1) !cd在这里不起作用。我仍然在google drive的当前文件夹中 2) 相反,我直接运行: !git clone https:/

在Colaboratory中,我们被迫使用pip安装。一些第三包,如健身房、PLE等,其安装应

git clone https://github.com/ntasfi/PyGame-Learning-Environment.git
cd PyGame-Learning-Environment/
pip install -e .
当我尝试时,以下是一些问题:

1)
!cd在这里不起作用。我仍然在google drive的当前文件夹中

2) 相反,我直接运行:

!git clone https://github.com/ntasfi/PyGame-Learning-Environment.git 
!pip install -e PyGame-Learning-Environment 
它说安装成功,但我无法导入。我选中了,但它没有出现在
/usr/local/lib/python3.6/dist包中

我还通过以下方式检查了python:

import os
print(os.getcwd())
这给了我:
/content
,一个我不理解的目录。显然,我不能导入这个包

我该怎么办?

以下是一个有效的示例:

小贴士:

  • 使用
    os.chdir
    而不是
    !cd
    <代码>命令在子shell中执行,因此其效果不会应用于后续命令<但是,code>os.chdir
  • 您想检查
    sys.path
    ,而不是站点软件包,因为您是使用
    -e
    安装的
  • 您还需要安装
    pygame
    。看起来这是一个未上市的部门
  • 完整安装配方:

    import os
    !git clone https://github.com/ntasfi/PyGame-Learning-Environment.git
    os.chdir('PyGame-Learning-Environment')
    !pip install -e .
    !pip install pygame
    os.chdir('/content')
    
    下面是一个成功的例子:

    小贴士:

    • 使用
      os.chdir
      而不是
      !cd
      <代码>命令在子shell中执行,因此其效果不会应用于后续命令<但是,code>os.chdir
  • 您想检查
    sys.path
    ,而不是站点软件包,因为您是使用
    -e
    安装的
  • 您还需要安装
    pygame
    。看起来这是一个未上市的部门
  • 完整安装配方:

    import os
    !git clone https://github.com/ntasfi/PyGame-Learning-Environment.git
    os.chdir('PyGame-Learning-Environment')
    !pip install -e .
    !pip install pygame
    os.chdir('/content')
    

    您应该使用pip3而不是pip吗?您应该使用pip3而不是pip吗?我无法在遵循您的步骤后导入模块。有什么帮助吗?我无法按照您的步骤导入模块。有什么帮助吗?