简体   繁体   English

如何在Ubuntu 16.04(64位)上更正我的python3环境

[英]How to correct my python3 environment on Ubuntu 16.04 (64 bit)

I tried to install the mysql connector for my python environment. 我试图为我的python环境安装mysql连接器。 I use python on my Linux (Ubuntu 16.04) machine. 我在Linux(Ubuntu 16.04)机器上使用python。 On this machine python 2.7.12 and python 3.5.2. 在这台机器上,python 2.7.12和python 3.5.2。 I probably messed something up because of my inexperience with installing new python modules. 由于安装新的python模块的经验不足,我可能搞砸了。 When I now try to install the mysql connector with the command 当我现在尝试使用以下命令安装mysql连接器时

pip3 install mysql-connector-python-rf

I get the following messages: 我收到以下消息:

Collecting mysql-connector-python-rf Downloading mysql-connector-python-rf-2.2.2.tar.gz (11.9MB) 100% |████████████████████████████████| 收集mysql-connector-python-rf下载mysql-connector-python-rf-2.2.2.tar.gz(11.9MB)100%|████████████████████ ██████████████| 11.9MB 131kB/s Building wheels for collected packages: mysql-connector-python-rf Running setup.py bdist_wheel for mysql-connector-python-rf ... done Stored in directory: /home/claude/.cache/pip/wheels/bb/53/e4/dced82f8a15f96a8afbe626ebb2939d2901b29e610a97fc1ba Successfully built mysql-connector-python-rf Installing collected packages: mysql-connector-python-rf Exception: Traceback (most recent call last): File "/home/claude/.local/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main status = self.run(options, args) File "/home/claude/.local/lib/python3.5/site-packages/pip/commands/install.py", line 342, in run prefix=options.prefix_path, File "/home/claude/.local/lib/python3.5/site-packages/pip/req/req_set.py", line 784, in install **kwargs File "/home/claude/.local/lib/python3.5/site-packages/pip/req/req_install.py", line 851, in install self.move_wheel_files(self.source_dir, root=root, prefix=prefix) File "/home/claude/.local/lib/python3.5/site-packages/pip/req/req_inst 11.9MB 131kB / s用于收集软件包的构建轮:mysql-connector-python-rf运行setup.py bdist_wheel用于mysql-connector-python-rf ...完成存储在目录中:/home/claude/.cache/pip/wheels / bb / 53 / e4 / dced82f8a15f96a8afbe626ebb2939d2901b29e610a97fc1ba成功构建mysql-connector-python-rf安装收集的软件包:mysql-connector-python-rf例外:追溯(最近一次调用):文件“ /home/claude/.local/lib/ python3.5 / site-packages / pip / basecommand.py“,第215行,主要状态= self.run(options,args)文件” /home/claude/.local/lib/python3.5/site-packages/ pip / commands / install.py”,行342,在运行prefix = options.prefix_path,文件“ /home/claude/.local/lib/python3.5/site-packages/pip/req/req_set.py”,行784,在安装** kwargs文件“ /home/claude/.local/lib/python3.5/site-packages/pip/req/req_install.py”中,行851,在安装self.move_wheel_files(self.source_dir,根目录下= root,prefix = prefix)文件“ /home/claude/.local/lib/python3.5/site-packages/pip/req/req_inst all.py", line 1064, in move_wheel_files isolated=self.isolated, File "/home/claude/.local/lib/python3.5/site-packages/pip/wheel.py", line 345, in move_wheel_files clobber(source, lib_dir, True) File "/home/claude/.local/lib/python3.5/site-packages/pip/wheel.py", line 316, in clobber ensure_dir(destdir) File "/home/claude/.local/lib/python3.5/site-packages/pip/utils/ init .py", line 83, in ensure_dir os.makedirs(path) File "/usr/lib/python3.5/os.py", line 241, in makedirs mkdir(name, mode) PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/mysql_connector_python_rf-2.2.2.dist-info' all.py”,行1064,在move_wheel_files isolated = self.isolated中,文件“ /home/claude/.local/lib/python3.5/site-packages/pip/wheel.py”,行345,在move_wheel_files clobber(来源,lib_dir,True)文件“ /home/claude/.local/lib/python3.5/site-packages/pip/wheel.py”,行316,位于clobber sure_dir(destdir)文件“ / home / claude /。本地/lib/python3.5/site-packages/pip/utils/ init .py“,第83行,在sure_dir os.makedirs(path)文件“ /usr/lib/python3.5/os.py”,第241行中,位于makedirs mkdir(名称,模式)中PermissionError:[Errno 13]权限被拒绝:'/usr/local/lib/python3.5/dist-packages/mysql_connector_python_rf-2.2.2.dist-info'

How can a correct this problem? 如何解决这个问题? Or How can I do a correct fresh install of my python2 and python3 environment on my Ubuntu 16.04 x86 Linux? 或如何在Ubuntu 16.04 x86 Linux上正确全新安装python2和python3环境?

There is nothing wrong with your installation. 您的安装没有任何问题。 To install packages globally, you need superuser privileges; 要全局安装软件包,您需要超级用户权限; you would run that command under sudo . 您将在sudo下运行该命令。

However, you should avoid doing this. 但是,您应该避免这样做。 Create a virtualenv and install the package there. 创建一个virtualenv并将软件包安装在那里。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM