Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.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
Mac使用sudo运行python会使它得到错误的库_Python_Macos_Sudo_Six - Fatal编程技术网

Mac使用sudo运行python会使它得到错误的库

Mac使用sudo运行python会使它得到错误的库,python,macos,sudo,six,Python,Macos,Sudo,Six,我正试图在我的mac电脑上安装pycuda。 问题是,当我使用sudo运行python时,python 6的版本是错误的,这是pycuda所要求的。 我怎样才能解决这个问题 Jean-Lucs-MacBook-Pro:test Jean$ sudo python Password: Python 2.7.6 (default, Sep 9 2014, 15:04:36) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on dar

我正试图在我的mac电脑上安装pycuda。 问题是,当我使用sudo运行python时,python 6的版本是错误的,这是pycuda所要求的。 我怎样才能解决这个问题

Jean-Lucs-MacBook-Pro:test Jean$ sudo python
Password:
Python 2.7.6 (default, Sep  9 2014, 15:04:36) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pkg_resources
>>> pkg_resources.get_distribution("six").version
'1.4.1'
>>> import six
>>> print six.__file__
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six.pyc
>>>


Jean-Lucs-MacBook-Pro:test Jean$ python
Python 2.7.6 (default, Sep  9 2014, 15:04:36) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pkg_resources
>>> pkg_resources.get_distribution("six").version
'1.9.0'
>>> import six
>>> print six.__file__
/usr/local/lib/python2.7/site-packages/six.pyc
>>>

以普通用户身份键入
哪个python
,然后查看您正在运行哪个python。更改root的PATH环境变量,使root运行与您相同的路径。它与python相同,您需要将
/usr/local/lib/python2.7/site packages
放在root路径的第一位
导入sys;sys.path
output for tware?for
sudopython
syspath返回一个较小的字符串