无法使用 pip 安装 "posix" 包
Can not install "posix" package using pip
我在我的电脑上安装了 Anaconda (windows),然后我尝试 运行 以下操作:
import pdb
import sys
import os
import posix
sys.path.append(os.path.join(posix.environ['HOME'], 'mlprojects', 'swig', 'src'))
sys.path.append(os.path.join(posix.environ['HOME'], 'mlprojects', 'datasets', 'python'))
sys.path.append(os.path.join(posix.environ['HOME'], 'mlprojects', 'mlopy', 'netlab'))
##ENDSETUP
import ndlml as nl
import ndlwrap as nw
import numpy as np
import datasets
import netlab
import matplotlib.pyplot as pp
import matplotlib.mlab as ml
import matplotlib.axes
import math
在运行上面的代码之后,我得到了以下错误:
File "C:/Users/yat/test.py", line 9, in <module>
import posix
ImportError: No module named posix
当我尝试 pip install posix
时,我收到以下消息:
Collecting posix
Could not find a version that satisfies the requirement posix (from versions)
No matching distribution found for posix`
如何安装 posix
包,以及在 Anaconda 中哪里可以找到所有已安装的包?
这是 Windows 上不可用的内置模块。看看the documentation:
Do not import this module directly. Instead, import the module os
,
which provides a portable version of this interface. On Unix, the os
module provides a superset of the posix
interface. On non-Unix operating
systems the posix
module is not available, but a subset is always
available through the os
interface. Once os
is imported, there is
no performance penalty in using it instead of posix
. In addition,
os
provides some additional functionality, such as automatically calling
os.putenv
when an entry in os.environ
is changed.
所以只需将 posix
替换为 os
就可以了。
要列出所有已安装的 Anaconda 软件包,请查看 the docs:
List all of your packages in the active environment:
conda list
To list all of your packages installed into a non-active environment
named snowflakes
:
conda list -n snowflakes
我在我的电脑上安装了 Anaconda (windows),然后我尝试 运行 以下操作:
import pdb
import sys
import os
import posix
sys.path.append(os.path.join(posix.environ['HOME'], 'mlprojects', 'swig', 'src'))
sys.path.append(os.path.join(posix.environ['HOME'], 'mlprojects', 'datasets', 'python'))
sys.path.append(os.path.join(posix.environ['HOME'], 'mlprojects', 'mlopy', 'netlab'))
##ENDSETUP
import ndlml as nl
import ndlwrap as nw
import numpy as np
import datasets
import netlab
import matplotlib.pyplot as pp
import matplotlib.mlab as ml
import matplotlib.axes
import math
在运行上面的代码之后,我得到了以下错误:
File "C:/Users/yat/test.py", line 9, in <module> import posix ImportError: No module named posix
当我尝试 pip install posix
时,我收到以下消息:
Collecting posix Could not find a version that satisfies the requirement posix (from versions) No matching distribution found for posix`
如何安装 posix
包,以及在 Anaconda 中哪里可以找到所有已安装的包?
这是 Windows 上不可用的内置模块。看看the documentation:
Do not import this module directly. Instead, import the module
os
, which provides a portable version of this interface. On Unix, theos
module provides a superset of theposix
interface. On non-Unix operating systems theposix
module is not available, but a subset is always available through theos
interface. Onceos
is imported, there is no performance penalty in using it instead ofposix
. In addition,os
provides some additional functionality, such as automatically callingos.putenv
when an entry inos.environ
is changed.
所以只需将 posix
替换为 os
就可以了。
要列出所有已安装的 Anaconda 软件包,请查看 the docs:
List all of your packages in the active environment:
conda list
To list all of your packages installed into a non-active environment named
snowflakes
:conda list -n snowflakes